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

restrict column to hold certain values

Thread ID:





68440 Sep 21,2007 01:52 PM UTC Sep 26,2007 03:57 AM UTC WinForms 1
Tags: GridControl
Asked On September 21, 2007 01:52 PM UTC


I need a datacolumn in a databoundgrid that can check if the user entered in a number that is within a specified range. So, for example, if I specify a range that is between 10 and 20, the user cannot enter 100 into the column. Is there a maskedtextbox or something of that sort that I can use? Or is there another easy way to do it? Thanks!

Golda Rebecal [Syncfusion]
Replied On September 26, 2007 03:57 AM UTC


You can achieve this requirement by checking the required condition in CurrentCellValidating event.

Here is the code snippet:

void gridDataBoundGrid1_CurrentCellValidating(object sender, CancelEventArgs e)
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
int value = Int32.Parse(cc.Renderer.ControlText);
if (value < 10 || value > 20 && cc.ColIndex == 1)
e.Cancel = true;
MessageBox.Show("Enter value between 10 and 20");

Kindly let me know if this helps you.

We appreciate your interest in Syncfusion products.

Best regards,


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