We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Totaling cell values in a row

Thread ID:





30329 Jun 16,2005 04:30 AM UTC Jun 16,2005 08:08 AM UTC WinForms 1
Tags: GridControl
Helmut Scheiss
Asked On June 16, 2005 04:30 AM UTC

I using a GDBG master-detail grid. There are 3 columns in the detail row that I''d like to add up and display in a read-only SUBTOTAL column for that row. In addition, I want to summarize all of the detail row SUBTOTAL columns and display that value in a read-only TOTAL column in the related master grid row. I''m still trying to understand what events fire when and could really use some help. I bet this has been asked a million times. Thank you. I love your product!

Administrator [Syncfusion]
Replied On June 16, 2005 08:08 AM UTC

If you use a GridGroupingControl for your grids, you can do this more easily using the technique shouwn in the \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\Grouping\SummaryInCaption sample. To do it in a GridDataBoundGrid, this will take significant work. Getting the summary row in teh details, you could use a technique like the one described in this KB. http://www.syncfusion.com/Support/article.aspx?id=10398 To get the summaries in the parent row is more of a problem. You would have to add unbound columns (get add a GridBoundColumn with a MappingName not in your Master DataTable). You would then handle grid.Model.QueryCellInfo to provide the values to these unbound columns on demand. Here is where the a problem comes up. The details grid is not really there until you display it. So, you would not be able to just grab this summary information from the details grid (unless all teh details are always visible). So, one way around this would be to loop through all the parent rows. For each row, create a DataView that holds teh rows from that particular detail by setting the RowFilter property appropriately when you create the DataView. Then loop through the DataView and compute the summary information you want, and store it in a Hashtable with the key being the parentColumnValue of the master-details relation(or ArrayList if you are not allowing sorting on the master grid). Then you could handle the CurrentCellValidateChanges in the details grid to adjust the sum cached in the Hashtable if the currentcell being changed in the details is part of the summary information. After the Hashtable is completely computed, you can use it it grid.Model.QueryCellInfo to provide the values for you unbound column in the master grid.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon