Home Forums WinForms controls Xceed Grid for WinForms Detail Grid Summary (Sum) Reply To: Detail Grid Summary (Sum)

User (Old forums)
Post count: 23064

Ok I got it to work with a ValueRow and TextRow, too bad the sample directory didn’t have anything as simple as this to show a person coming from the Delphi world.

It is a bit daunting to go through 2000 lines of code in a sample project, picking only parts that you need for a simple sum of a column in a detail grid.

The following code works for me, and is put inside the valueRow SiblingDataRowsChanged event. [The “Quantity” field below has to be replaced to fit your table in use.]

private void valueRow1_SiblingDataRowsChanged(object sender, System.EventArgs e)

ValueRow mySummaryRow = ( ValueRow )sender;
System.Int16 total = 0;

foreach( Xceed.Grid.DataRow row in mySummaryRow.ParentGroup.GetSortedDataRows( false ) )
total += ( System.Int16 )row.Cells[ “Quantity” ].Value;

mySummaryRow.Cells[“Quantity”].Value = total.ToString();


Imported from legacy forums. Posted by Artmic (had 347 views)