CoderWannaBe
.Net blog

DevExpress AspxGrid – calculating grand totals (column totals) in the footer when dynamically generating columns

January 8, 2011 01:32 by bstinson

If you read yesterday’s post, you know I was having a hard time with a report that uses an AspxGrid to display the data.  I solved the problem that was causing an error when I did a postback and the number of columns had changed, but then I started working on adding totals to the footer and ran into another issue.

I couldn’t figure out for the life of me why I could specify a column by name and add the total, but when I tried to determine the column names (since they are dynamically generated) so that I could add the totals (that is how you do it with the DevExpress AspxGrid), the footer was always blank.

I finally figured out the issue was a timing issue.  If I try to set the totals up after databind, they do not show up because that is when the control actually calculates the totals.  I couldn’t figure out how to get the names without databinding either, so I thought I was stuck.  Then, the light bulb flickered.  I decided to just look at my datatable (since it has the field names I am using in it) before I do the data bind and setup the totals.

DevExpress has some good examples of how to set up the totals in the footer, just none that help you figure out the column names when you don’t know them.


Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories:
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Related posts

Comments are closed