I have a problem. In my page, there have 3 gridview.
Every gridview has sub total displaying at its footer.
I am able to display the sub total for each gridview at its footer.
But, i want to display one more total that is grand total.
The value for the grand total is the total of sub total from each gridview.
I want to display the grand total value using label.
I don't know how to do it and I don't have any idea how to take the subtotal value from each gridview to make the calculation.
Can someone help me,please??
maria_mj 0
Light Poster
Recommended Answers
Jump to PostYou can do this thing like in below way :
I assume you are showing sub total of all three gridview in TextBox in footerrow. So your code may look like.
TextBox t1 = yourfirstGridView.FooterRow().FindControl(“control id where you are showing subtotal”)
TextBox t2 = yoursecondGridView.FooterRow().FindControl(“control id where …
Jump to Posttry to execute below modified code.
int totalRevenue = Convert.ToInt32(GridView1.FooterRow().Cells[2].Text) + Convert.ToInt32(GridView2.FooterRow().Cells[2].Text) + Convert.ToInt32(GridView3.FooterRow().Cells[2].Text);
int totalProfit = Convert.ToInt32(GridView1.FooterRow().Cells[3].Text) + Convert.ToInt32(GridView2.FooterRow().Cells[3].Text) + Convert.ToInt32(GridView3.FooterRow().Cells[3].Text);
grandRevenue.Text = totalRevenue.ToString();
grandProfit.Text = totalProfit.ToString();
Jump to PostHave you tired below part from my first thread? If not then try it by storing the value in viewstate and use it.
when you calculate sub total for each gridview and displaying it in label or textbox, at that time also store in ViewState like
ViewState(“subtotal1”) = subtotal …
All 11 Replies
rohand 1
Posting Whiz in Training
maria_mj 0
Light Poster
rohand 1
Posting Whiz in Training
maria_mj 0
Light Poster
rohand 1
Posting Whiz in Training
maria_mj 0
Light Poster
rohand 1
Posting Whiz in Training
maria_mj 0
Light Poster
rohand 1
Posting Whiz in Training
maria_mj 0
Light Poster
rohand 1
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.