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.

restrict column to hold certain values

Thread ID:

Created:

Updated:

Platform:

Replies:

68440 Sep 21,2007 09:52 AM Sep 25,2007 11:57 PM Windows Forms 1
loading
Tags: GridControl
John
Asked On September 21, 2007 09:52 AM


Hi,

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 25, 2007 11:57 PM

Hi,

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,
Golda

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.

;