954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

adding column in a nested gridview

can someone please help me.. im working on a nested gridview where the parent gridview displays the majorcategory while the childgridview displays the material, unit cost, quantity, total etc...my problem is whenever i clicked on the compute button it does not compute subtotals..meaning it continuously add the value. i need to first compute the subtotal per childgridview and then add all the subtotal to get the grandtotal..here is my code in the button click...please help..it s urget...our thesis deadline is fast approaching..i need to finish this functionality immediately..thanks in advance

protected void BtnCompute_Click(object sender, EventArgs e)
{

foreach (GridViewRow parentgrdview in GridView1.Rows)
{
GridView childgrdview = (GridView)parentgrdview.FindControl("GridView2");
GridViewRow footerRow = childgrdview.FooterRow;


foreach (GridViewRow row in childgrdview.Rows)
{

decimal price;
Label total = (Label)row.FindControl("lblTotal");
Label sub = footerRow.FindControl("lblSubTotal") as Label;

price += decimal.Parse(total.Text);

sub.Text = price.ToString();

}

}

}

krisel
Newbie Poster
1 post since Jul 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You