We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

currency cell precision question

Hi -
I am using the GridControl, version 5.2.0.25.
I have currency cells with CurrencyDecimalDigits = 2 and CellValueType = double.

When i set the value to be something like 0.0000001, i get the following behavior. When not in edit mode, the value displayed in the cell is "0.00". When the user enters the cell to edit, the value is "107.00". When i step through the code and trap the CurrentCellStartEditing event, i see the following:
CurrentCell.Renderer.ControlValue = 0.0000001
CurrentCell.Renderer.ControlText = "0.00"
CurrentCell.Renderer.Control.Text = "107.00"

I understand the zero value and am fine with that. But why the 107? What can i do to prevent this.

Thanks,
Julie


6 Replies

HA haneefm Syncfusion Team December 27, 2007 10:30 PM UTC

Hi Julie,

One way you can do this by hanlding the CurrentCellInitializeControlText event of the grid and set the e.ControlText to newText. Below are the codes:

this.gridControl1.CurrentCellInitializeControlText += new GridCurrentCellInitializeControlTextEventHandler(gridControl1_CurrentCellInitializeControlText);

void gridControl1_CurrentCellInitializeControlText(object sender, GridCurrentCellInitializeControlTextEventArgs e)
{
e.ControlText = Convert.ToString( e.Style.FormattedText ) ;
}

Best regards,
Haneef



JL Julie Levy December 28, 2007 07:19 PM UTC

Thanks for your response. This seems to work ok.




JL Julie Levy January 3, 2008 10:59 PM UTC

Hi -
Actually this doesn't work.
If you tab into a cell and then just start typing... the initialize event is triggered and the formatted text is "" which overwrites what was typed.
If you click into the cell first, the initialize event is triggered before the user has typed and, thus, everything is ok.

Any other ideas on how to handle this or anything i can check?

Thanks,
Julie



JL Julie Levy January 3, 2008 11:15 PM UTC

Hi -
Basically any time you tab into a cell to edit it (whether it's empty or has a value), the old value contained in the style overwrites what the user is typing on the first keystroke.

So I don't think this approach can work for me. Any idea why the controltext is 107 in my original example. Is there a way to "fix" this so i don't have to do anything in the intialize event.

Thanks,
Julie



SR SubhaSheela R Syncfusion Team January 9, 2008 10:14 AM UTC

Hi Julie,

We suspect the issue "ActiveCurrencyCell shows default value" to be a defect. Could you please create a Direct-Trac incident with the subject "F70728 - Active currency cell shows default value" so that we could give more details regarding the fix?

Regards,
Subhasheela R



JL Julie Levy January 10, 2008 12:18 AM UTC

Thanks.


Loader.
Live Chat Icon For mobile
Up arrow icon