Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1145
How to have UltraWinGrid / CalcManger's Formulas recalculate after UltraNumericEditor update?
posted

Hello, I am setting my grid's datasource to a dataset object returned from a sql stored procedure. 

In the grid's initialize layout I wire-up the calc manager:

 

this

 

.ugCommentary2.CalcManager = this.ultraCalcManager1;

 

 

I then wire-up a formula in one of the grid's columns:

 

e.Layout.Bands[0].Columns[

"MTD Gross Attribution"].Formula = string.Format("( ROUNDUP((([MTD % Contribution] * {0}) * 100),2) )",numGrossRetMTD.Text);

 

 

This works great, but only when you set the grid's datasource.  "numGrossRetMTD" (above) is my UltraNumericEditior control.  *My goal is to have all formula's in the grid re-fire every time a value is updated in the numeric editor control. 

Just looking for the cleanest way to accomplish this.  Many thanks in advance!

PS - I also tried adding the editor control to the calc settings in my form load event:

Infragistics.Win.UltraWinCalcManager.CalcSettings calcSettings = new Infragistics.Win.UltraWinCalcManager.CalcSettings();

calcSettings.PropertyName = "GrossRetMTD";

calcSettings.TreatAsType =

typeof(double);

 

this

 

.ultraCalcManager1.SetCalcSettings(this.numGrossRetMTD, calcSettings); 

...but I have a feeling this was a pathetic attempt...

 

Parents
  • 469350
    Offline posted

    Hi,

    The problem here is that you are hard-coding your formula with the current value (text) of the Numeric editor, rather than actually referring to the UltraNumericEditor in the formula itself.

    The proper way to do this is like so:

    .Formula ="( ROUNDUP((([MTD % Contribution] * [\\numGrossRetMTD]) * 100),2) )";

    You probably also need to make sure that the NumericEditor is added to the CalcNetwork. The easiest way to do this is to go to the NumericEditor control at design-time and edit the CalcSettings.PropertyName and set it to Text.

    But you seem to be doing all of this at run-time. So you could do it like this:


                CalcSettings calcSettings = this.ultraCalcManager1.GetCalcSettings(this.ultraNumericEditor1);
                calcSettings.PropertyName = "Text";
                calcSettings.TreatAsType = typeof(double);

     

Reply Children