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. Image for the cookie policy date

Data Validation

I would like to implement my own validation routines for the grid. I have tried events like CurrentCellValidating and CurrentCellChanging. These events have the arguments “System.ComponentModel.CancelEventArgs e” and “Syncfusion.Windows.Forms.Grid.GridCellsChangingEventArgs e”. Setting “e.Cancel = true” does abort the editing, but how can I get the value entered by the user . All the properties that I have tried return the data that is already present in the grid, not the data being entered by the user. This data is needed to perform the validation. Teo

1 Reply

CB Clay Burch Syncfusion Team August 6, 2002 01:20 PM UTC

You can get at this value through the CurrentCell.Renderer.
private void gridControl1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e)
{
	string newValue = this.gridControl1.CurrentCell.Renderer.ControlText;
	string oldValue = this.gridControl1[this.gridControl1.CurrentCell.RowIndex, this.gridControl1.CurrentCell.ColIndex].Text;
	Console.WriteLine(newValue + "   " + oldValue);
}

Loader.
Live Chat Icon For mobile
Up arrow icon