I have a WinGrid with two bands. The second band contains summary rows in each group (just simple SUM rows). I need to check that the SUM value does not exceed 100.
I cannot find anything in the documentation or forums to show how to access the value calculated in the summary row before a user saves the data. I saw something about casting the summary row to an UltraGridGroupRow - but this throws an exception ("Unable to cast...").
UltraGridGroupByRow gbr = (UltraGridGroupByRow)row;
object s = gbr.Rows.SummaryValues["Sum"].Value;
This is the correct way to do it. If you are getting an exception when casting to a GroupByRow, then the row must not be a GroupbyRow. So either you are not grouping, or you are usng the wrong row. Or maybe you are trying to access the row before the grid has been grouped. Check the row.IsGroupByRow property to see if the row is a GroupByRow or not.
Hi Mike
I am not following the terminology here - I understand a "group" as something you create to consist of one or more columns in a grid. By groups are you referring to the bands? My grid basically contains parent/child data, where each row in Band[0] expands to show child rows in Band[1]. There is a summary row added to Band[1], so a SUM value is displayed to summarize each child row section - and this is the value I need to get.
Can you please help clarify this?