SumColumn: Custom DataGrid Column that automatically shows Sum/Count/Average in DataGrid Footer.
A normal requirement in any ASP.Net application is to sum/average up the values in a DataGrid column to the Footer. In this article we will compare the normal methods and later create our own custom DataGrid column SumColumn, derived from BoundColumn to avoid repetition of the same code.
The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: SumColumn: Custom DataGrid Column that automatically shows Sum/Count/Average in DataGrid Footer.
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
StevePosted May 26, 2009, 10:59 AM
I did something mildly similar before. Rather than write ASP.Net code to summarize data, I used T-SQL and temporary tables. One grid that represents the detail of the data, a second one that summarizes, in this case money, values such as Month-To-Date and Year-To-Date. Both are temporary tables returned by the stored procedure but who's life-span is the execution of the procedure. It's quick and clean, and all the logic and work is back-ended to the server. The ASP.Net code is just a few lines, amounting to assigning the result set from the procedure to the grid.
shafaqat aliPosted May 21, 2009, 12:53 AM
System.Web.UI.WebControls.DataControlFieldCollection must have items of type 'System.Web.UI.WebControls.DataControlField'. 'Custom:CustomColumn' is of type 'Custom.CustomColumn'. "Custom"=My ClassLibraryName "CustomClass"= my class name
Jorge SalinasPosted May 20, 2009, 3:46 PM
Very useful, i'm using this right away.
rama kishoreeditedPosted Feb 21, 2006, 5:39 AMEdited Apr 18, 2006, 10:49 AM
It is very useful application. while way of telling the application is also very good. my email is [email protected] Regards, ramakishore. [edit]