Mohammed Nadeem

Mohammed Nadeem

  • NA
  • 78
  • 8.8k

Getting sub total of nested gridview dynamic rows

Apr 19 2017 3:16 PM
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.
 
 What I have tried:

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();
}


}

Answers (1)