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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How do I validate user entry to a Grid.Grouping?

Thread ID:





117105 Aug 12,2014 10:10 PM UTC Aug 16,2014 02:31 PM UTC WinForms 1
Tags: GridGroupingControl
Tuan Lam
Asked On August 12, 2014 10:10 PM UTC

Our cell is integer value and the user entered a value bigger than int32 (ie 123456789012), they will get a dialog saying "123456789012 is not a valid value for Int32".  How do suppress this dialog or validate user's input?

Muthukumar Kalyanasundaram [Syncfusion]
Replied On August 16, 2014 02:31 PM UTC

Hi Tuan,


Thank you for your interest in Syncfusion products.


If you want to validate the user input for Int32 in a grid, you can use the ‘Int32.TryParse()’ method. It Converts the string representation of a number to its 32-bit signed integer equivalent. Please refer the below code,


Code Snippet[C#]:-


            this.gridGroupingControl1.TableModel[5, 3].CellType = GridCellTypeName.TextBox;

            this.gridGroupingControl1.TableModel[5, 3].Text = "123456789012";

            String s = (this.gridGroupingControl1.TableModel[5, 3].Text).ToString();

            int count = s.Length;

            String sd = this.gridGroupingControl1.TableModel[5, 3].Text;           

            int number2;

            bool result = Int32.TryParse(this.gridGroupingControl1.TableModel[5, 3].Text, out number2);

            if(result == false)


                 for(int i = count-1 ;i > 9 ;i--)


                    sd = sd.Remove(i);

                    this.gridGroupingControl1.TableModel[5, 3].Text = sd;


                MessageBox.Show("Not enter more than Int32 Value");


            this.gridGroupingControl1.TableDescriptor.Columns["I3"].Appearance.AnyRecordFieldCell.MaxLength = sd.Length;


Please let us know if you have any concern.



Muthukumar K

Attachment: setMaxValue_19aa960b.zip


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon