One approach is to insert the subtotal into the footer row of the datagrid
in the itemdatabound routine.
if(e.itemtype == listitemtype.footer)
string strCol = columname;
e.item.cells[0].Columnspan = 2;
e.item.cells[0].Text = "Sum";
e.item.cells[0].BackColor= Color.LimeGreen;
e.item.cells[1].Text =
ds.Tables[0].Compute("Sum(["+strCol+"])",String.Empty));
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Atif Jalal" <ma***@hotmail.com> wrote in message
news:b7**************************@posting.google.c om...
Hi,
I would like to know if there is a way to print 'Sum' of all the
values of one of the columns in a datagrid in an ASP.net application
using vb.net. The Sum should be displayed all the way at the end below
the column values.
Like:
___________________________
Column1 Column2 Column3
___________________________
XX
YY
ZZ
--
SUM AA
--
___________________________