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.
Unfortunately, activation email could not send to your email. Please try again.

currency cell precision question

Thread ID:

Created:

Updated:

Platform:

Replies:

70728 Dec 27,2007 05:03 PM Jan 9,2008 07:18 PM Windows Forms 6
loading
Tags: GridControl
Julie Levy
Asked On December 27, 2007 05:03 PM

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


haneefm [Syncfusion]
Replied On December 27, 2007 05:30 PM

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


Julie Levy
Replied On December 28, 2007 02:19 PM

Thanks for your response. This seems to work ok.



Julie Levy
Replied On January 3, 2008 05:59 PM

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


Julie Levy
Replied On January 3, 2008 06:15 PM

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


SubhaSheela R [Syncfusion]
Replied On January 9, 2008 05:14 AM

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


Julie Levy
Replied On January 9, 2008 07:18 PM

Thanks.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;