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

Detecting status of new row

I am validating fields in a row in a databound grid at the rowleave event. If a user is creating a new row and then changes his mind part way through, he cannot leave the row without meeting the validation criteria first. I need to be able to check the new row status, at the rowleave event, so that I can see if the ESC key has been pressed to cancel the new row entry. Then I can allow the user to leave without validation. How do I do this?

1 Reply

AD Administrator Syncfusion Team June 8, 2004 03:30 PM

If you have this property set so the cell is active when it become current, this.gridDataBoundGrid1.ActivateCurrentCellBehavior = GridCellActivateAction.SetCurrent; then you can catch an Esc on the AddNewRow by handling this event.
private void gridDataBoundGrid1_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e)
{
	Keys keyCode = (Keys)((int)e.Msg.WParam) & Keys.KeyCode;
	if(keyCode == Keys.Escape && this.gridDataBoundGrid1.Binder.IsAddNew)
		Console.WriteLine("Escape on addnew row");
}

Loader.
Live Chat Icon For mobile
Up arrow icon