Hi Jim,
We need to handle TableControlCurrentCellValidating event to done validation on the grid cell before the values are getting committed. The Validating event is the best to handle when you want to validate the contents you entered. You can set e.Cancel to true in this event to indicate validation failed. See the code:
void gridGroupingControl1_TableControlCurrentCellValidating(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.CurrentCell.Renderer.CurrentStyle as GridTableCellStyleInfo;
if (style.TableCellIdentity.Column != null && style.TableCellIdentity.Column.Name == "Item")
{
if (e.TableControl.Table.CurrentRecord.Kind != DisplayElementKind.AddNewRecord)// Check for AddNewRecord
{
e.TableControl.Table.CurrentRecord.EndEdit();
}
else
{
GridCurrentCell cc = e.TableControl.CurrentCell;
if (cc.Renderer.ControlText == "wrong") // check for the desired value
{
MessageBox.Show("Not a valid value");
e.Inner.Cancel = true;
}
}
}
}
Sample for your reference:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GCCValidations1376151774.zipPlease let me know if this helps.
Regards,
Jisha