HA
haneefm
Syncfusion Team
January 2, 2008 11:59 PM UTC
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