{Using latest version}
Trying to get around a problem that I posted here:
http://community.infragistics.com/forums/p/52238/272066.aspx#272066
I want to access the summary rows in the grid so I can manually set a summary value. So I attached the following method. However, if I put a breakpoint inside the if statement the it is never activated - it does hit with the breakpoint on the "if" statement.
As you can see from the attached image, I clearly have summaries defined.
Any other way of doing this? Basically, because of the above referenced bug (?) I need to figure out a way to manully insert a value for "Summary = " which is the difference of DRSum - CRSum
private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.IsSummaryRow) { double d1 = 0.0; double d2 = 0.0; double d3 = 0.0; d1 = (double)e.Row.GetCellValue("DR"); d2 = (double)e.Row.GetCellValue("CR"); d3 = d1 - d2; } }
Same behaviour with ultraGrid2_InitializeGroupByRow method
Thanks
InitializeRow doesn't fire for summary rows. You can assume control of the summary calculations by implementing the ICustomSummaryCalculator interface on a class, then passing an instance of that class to the SummariesCollection.Add method (one of the overloads has a parameter for this).
Hi Brian,
OK, then that's what I was confused about - the fact that IsSummaryRow even exists for the event arguments (InitializeRowEventArgs) if it's never even called for summary rows.
But I'm still confused because as I'm writing this I did a quick search here to see where/how IsSummaryRow is used and found this post:
http://community.infragistics.com/forums/p/49599/262506.aspx#262506
where Mike Saltzman suggests to use this tidbit of code:
Hi Sanjeev,
So all you need to do is make your SummaryRow fixed on top of the grid. That's easy.
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { if (IsSummaryRow(e.Row)) e.Row.Fixed = true; }
Hi,
In the post you linked here, that developer is using a regular data row to simulate a summary row - it's not a real summary row. That's why the sample code is using:
if (IsSummaryRow(e.Row))
instead of:
if (e.Row.IsSummaryRow)
In fact, there actually is no such thing as a SummaryRow in the grid. The object is never used except for the purposes of exporting. So that method will never be of much use to you. Brian's suggestion of using the ICustomSummaryCalculator is a good one. Another option is to use UltraCalcManager and apply a formula to your summary which contains a literal value. Like formula = "5".
OK...thanks Mike
>> Another option is to use UltraCalcManager and apply a formula to your summary which contains a literal value. Like formula = "5".
Yeah, I had read this/your suggestion in another post and tried it. It doesn't work for my scenario in this post
http://community.infragistics.com/forums/p/52238/272116.aspx#272116
When I attempt to use any formula (even this simple formula) in conjunction with groupings it bombs.
Hello,
On the following link you will find general help for using UltraCalckManager with UltraWinGrid:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2010.2/CLR2.0/html/Using_WinCalcManager_with_WinGrid.html
How to create calculated column you could find here :
http://help.infragistics.com/Help/NetAdvantage/WinForms/2010.2/CLR2.0/html/WinCalcManager_Creating_a_Calculated_Column_in_WinGrid.html
And also Using WinCalcManager to Create a Calculated Summary in WinGrid
http://help.infragistics.com/Help/NetAdvantage/WinForms/2010.2/CLR2.0/html/WinCalcManager_Using_WinCalcManager_to_Create_a_Calculated_Summary_in_WinGrid.html
I hope this help.