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.

Grid Cell generate Garbage Number if decimal set to 6 above and number < 1.

Thread ID:

Created:

Updated:

Platform:

Replies:

69212 Oct 18,2007 12:19 PM Oct 19,2007 06:33 PM Windows Forms 3
loading
Tags: GridControl
David
Asked On October 18, 2007 12:19 PM

Hi,

Not sure any one meet the following problem:

1. use syncfusion DataBoundGrid
2. set a column and cell as double value type, with CurrencyEdit allow 8 decimal places, init with 0.0000000

3. run above Grid, enter 0.0000002

4. move away the cursor from that cell, you will see the number becomes 0.000000. then come back , you will see some Garbage Number 708.000000 .

Any idea ?

David

haneefm [Syncfusion]
Replied On October 18, 2007 08:11 PM

Hi YC,

I am not sure of what be might be causing this strange behavior without a working sample. I have tested this issue in browser sample with Essentail studio V.4.x/5.x. But i was not able to reproduce the issue. Is it possible for you to upload us a minimal sample or modify the browser sample to reproduce the issue here? This will help us to analyse the issue further.

Best regards,
Haneef

David
Replied On October 19, 2007 09:02 AM


hi, Haneef,

please see the attached example. reproducing steps still the same.

thanks a lot!

David


DoubleTextBoxBug.zip

haneefm [Syncfusion]
Replied On October 19, 2007 06:33 PM

Hi David,

You can go for the TextBox celltype and the cellvaluetype as double for your needs. You can restrict the non-numeric entries to the cell handling the CurrentCellKeyPress event. To get the desired format for the cells, set the Style.Format in the PrepareViewStyle event handler. Please try the below code snippets

void gridDataBoundGrid1_CurrentCellKeyPress(object sender, KeyPressEventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
GridCurrentCell cc = grid.CurrentCell;
if (cc != null)
{
if (e.KeyChar == '.')
{
string sCellText = cc.Renderer.ControlText;
if (sCellText.IndexOf(".") != -1)
{
e.Handled = true;
}
}
else if (!char.IsNumber(e.KeyChar))
e.Handled = true;
else
{
GridTextBoxCellRenderer cr = cc.Renderer as GridTextBoxCellRenderer;
cr.TextBox.SelectionLength = 1;
}
}

}

private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex > 0 && e.Style.CellValue != null && e.Style.CellValue.ToString().Trim() != string.Empty)
{
e.Style.CellValueType = typeof(double);
e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
e.Style.Format = "F8";
}
}

Best regards,
Haneef

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.

;