Question : Sum column in datagrid

Simple example. If i have datagrid with Column Total.
Total
2
3
5

How could i calulate the sum of that column (2+3+5=10) and output the result to a label?

I am using VB.NET 2005 and ASP.NET 2.0.

Cheers.

Answer : Sum column in datagrid

You'll find a lot of tutorials on how to put a grid column total in the footer like this:
http://aspalliance.com/782

If your label is not in the footer, then, in code use the "GetTotal" function to set it to the label.text
The above uses functions and the aspx page.

If you wanted to do it all in code, you'd need to use the rowdatabound event of a grid:
http://msdn2.microsoft.com/en-us/library/ms972833.aspx
Random Solutions  
 
programming4us programming4us