The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have a Grouping Grid control where I have a column set as a NumericUpDown. I have set the Minimum and Maximum of the NumericUpDown to the required values and this works great at preventing a user from clicking the buttons and making the value exceed the minimum and maximum limits. Yet a user can still type in what ever they want. This could be a valid number that exceeds these limits or even a non-numeric value.
What I would like to do is simply prevent the user from typing an invalid value. I have tried a number of different ways but nothing seems to be a 100% solution.
RCRajadurai C Syncfusion Team May 20, 2009 12:59 PM UTC
Hi Brian,
Thanks for your interest in Syncfusion products.
With NumericUpDown celltype in gridgroupingcontrol, you can prevent user from entering any invalid entries into the cell by handling some validations manually. Please refer to the following code snippet, in which TableControlCurrentCellChanged and TableControlCurrentCellKeyPress events are handled to do such validations. //TableControlCurrentCellChanged event void gridGroupingControl1_TableControlCurrentCellChanged(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlEventArgs e) { GridCurrentCell cc = e.TableControl.CurrentCell; if (cc.Renderer is GridNumericUpDownCellRenderer) { GridNumericUpDownCellRenderer rend = cc.Renderer as GridNumericUpDownCellRenderer; if (rend != null && rend.ControlText != "") { int val = int.Parse(rend.ControlText); if (val < min || val > max) { cc.EndEdit(); rend.ControlText = value.ToString(); this.gridGroupingControl1.TableModel[cc.RowIndex, cc.ColIndex].Text = value.ToString(); } else value = int.Parse(rend.ControlText); } } } //initialization part int min=0, max=20, value = 0;