Getting sub total of nested gridview rows (ex: total price column ) in footer and grandtotal in a la
i am working with nested gridview. where i am having textboxes(item,quantity,price ) and a bound field for total price(value is coming from multiplying previous columns) in nested gridview , where columns text is entered dynamically and calulated text from (item,quantity,price) is obtained in total price bound field . i need the sum of all rows(totalprice) in footer of nested gridview and grand total in label outside gridview.under nested gridiview rowdatabound event i have written this code its not working//
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
int tmpTotal = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "txtTotalPrice").ToString());
qtyTotal += tmpTotal;
grQtyTotal += tmpTotal;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lblTotalprice = (Label)e.Row.FindControl("lblTotalprice");
lblTotalprice.Text = grQtyTotal.ToString();
}
}