Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 16, 2012 03:23 PM by superguppie
May 15, 2012 01:18 PM|LINK
I would like to calculate each column total in the footer but except one row.. i dont want to add that row in calculating Total.
i did to caluculate Total in GridView1_RowDataBound but its calculating all the values.
can you please help me to find this
May 15, 2012 11:10 PM|LINK
Post your code.
May 16, 2012 03:52 AM|LINK
One methos is to do it in Databound event and get the sum looping through the number of rows you need.
May 16, 2012 04:08 AM|LINK
set hiddenfield into gridview templatefield to indicate that row should not be included in total as your requirement
and in rowdatabound event just check that hidden field if matches then exclude it from suming up and go ahead
I hope this helps you.
May 16, 2012 04:55 AM|LINK
Don't use row_databound event for gridviewrow total
after binding gridview. then start foreach statement for gridview
and find control which render values u want to be total
foreach(gridviewrow row in gridview1.rows)
amount+=convert.todecimal( ((label)row.findcontrol("your label id")).text);
May 16, 2012 03:23 PM|LINK
Using RowDataBound sounds ok to me. But how do you know which row not to count? With the answer to that, check for each row if it is that row. If it is, don't count it.