Totals in grid footer?

S

Scott Mitchell [MVP]

Is there a way to show subtotals in the footer of a datagrid?

Essentially you need to keep a running total, updating the running total
in the ItemDataBound event handler for each Item or AlternatingItem.
For the Footer, you need to programmatically insert this running total
value.

There's an article here that shows how to accomplish this and more:
http://aspnet.4guysfromrolla.com/articles/073003-1.aspx

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
S

SoftLion

Or simply you can add a Table to your DataSet (it supports more than one
table/=result set/=query returned all in only one database roundtrip !) with
totals in it and modify the FooterItemTemplate of each item to display the
content of this second table.
This way you'll get the total correct even if pagination is turned on.

4GuysFromRolla rocks, thanks to you for your excellent datagrid's articles !
It's the best jump start I've found. Though you could improve the handling
of drop-downs (static) content by using the same technique as above.
What is missing is how to get a good user feeling when editing in a datagrid
: simulate smartnavigation while editing (add/delete/modify) the grid
content.

Benjamin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top