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.
You can easily do it with RowInitialize. In the event handler:
e.Row.Cells["Total"].Value = e.Row.GetCellValue(column1) + e.Row.GetCellValue(column2) ......
If setting the total value causing RowInitialize to fire again, you can disable the event temporarily before setting the value by using grid.EventManager.SetEnabled method.
Maybe there is a built-in solution for that that I'm not aware of.
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..
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