I'm really, really frustrated that I cannot find ANY information from Infragistics how to sum a row of data in a datagrid... NOT A COLUMN, A ROW! I know how to do column summaries...
I have an unbound grid that I don't know how many columns the row will have until run time.. How do I sum the values of the row and place them in the last column titled 'Total". Do I use Row_Initialize, UltraCalcManager (which I've never used..)... any help ??
This cannot be this difficult to accomplish!
Thanks.
Snap.. Thanx.. That's what I needed.. I think I have it working now... Kudos to you and much thanks!!
Ofcourse you can.
foreach (var column in e.Row.Band.Columns)
or
e.Row.Band.Columns.OfType<UltraGridColumn>().Sum(c => e.Row.GetCellValue(c))
Yeah, I thought of that also, problem I hit with it was you cannot use a foreach in the activerow to get the columns for that row...
Unless I'm missing something..
Thanks for your suggestion, but I must be missing the boat here..
First, I played with that example all morning and it ended up being a total waste of time. First, I do not know how many columns of data is being returned for each instance of the grid. So the example, which shows me defined columns in the calculation, is of no help to me. I could have 2 columns for one run and 12 columns in the row the next run..
Second, perhaps we are on different definations of the word "ROW".. I need totals for each line, I can get the column totals, no problem.. I need the totals for the row going West to East, not the columns running north to south...
I don't understand why Infrag cannot give decent examples how their controls work.. This exercise has been a total waste of time... and causing a very upset client who can't understand why something as simple as getting a row total is so confusing...
There is indeed another approach that one can use, which makes use of the WinCalcManager component in conjunction with the WinGrid control. For an example, see the following article from our online help documentation of NetAdvantage for Win Client 2009 Volume 1:Creating a Calculated Column in WinGrid