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.

validate string in ggc

Thread ID:

Created:

Updated:

Platform:

Replies:

70804 Jan 2,2008 07:50 AM Jan 2,2008 06:59 PM Windows Forms 1
loading
Tags: GridControl
abc
Asked On January 2, 2008 07:50 AM

I am using syncfusion ggc 5.2. I want that if user enters a string which is more than 1000 characters the cell should show a error with an error message(error message only when user points to error symbol of cell).
I will be v thankfull if anyone could help me in this.


haneefm [Syncfusion]
Replied On January 2, 2008 06:59 PM

Hi Prabhjeet,

To validate the grid cell string, you need to handle the TableControlCurrentCellValidateString and set the e.Inner.Cancel to true for invalid text. Below are the codes:

void gridGroupingControl1_TableControlCurrentCellValidateString(object sender, GridTableControlCurrentCellValidateStringEventArgs e)
{
Console.WriteLine(e.TableControl.CurrentCell.Renderer.ControlText.Length);
if( e.TableControl.CurrentCell.Renderer.ControlText.Length > 10 )
{
e.Inner.Cancel = true;
FieldDescriptor fd = e.TableControl.Table.CurrentRecordManager.CurrentField;
CurrentRecordProperty prop = e.TableControl.Table.CurrentRecordManager.Properties[ fd ];
prop.Exception = new Exception( "Invalid Text"); //Error Message in a Cell;
MessageBox.Show("Invalid Text"); //Poup Error Message
}

}

Best regards,
Haneef


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.

;