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 07:30 PM UTC

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.
Up arrow icon