Strange behavior in NumericUpDown cells

Hi,
I''ve got a grid which uses NumericUpDown cells (the ones integrated in GGC) to show some numbers. Whenever they change, I process some information relating to it.
However, if the user enters a very big number (such as 99999999), the cell turns into a bunch of zeroes and there''s no way to change it until I recreate the grid using other parts of the application.
Is this a known bug? Is there any way to solve it? Am I doing something wrong?

Thanks in advance

1 Reply

AD Administrator Syncfusion Team September 18, 2006 01:01 PM UTC

Hi Alejandro,

To avoid this from happening, you can handle the TableControlCurrentCellValidateString event of the grid. This event gets fired for each keystroke; so you can cancel this event by setting e.Cancel to true when the entered number is greater than the limit. Below is the code snippet.

private void gridGroupingControl1_TableControlCurrentCellValidateString(object sender, GridTableControlCurrentCellValidateStringEventArgs e)
{
double d;
double.TryParse(e.Inner.Text, System.Globalization.NumberStyles.Any, null, out d);
if(d > 999999)
e.Inner.Cancel = true;
}

FYI, you can use this GridNumericUpDownCellModel.AcceptAlphaKeys property, this lets you specify whether the NumericUpDown cell should accept Alpha keys.

GridNumericUpDownCellModel cm = (GridNumericUpDownCellModel) this.gridGroupingControl1.TableModel.CellModels["NumericUpDown"];
cm.AcceptAlphaKeys = false;

Regards,
Rajagopal

Loader.
Up arrow icon