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

GridGroupingControl: CancelEdit.

Hello. You already help me with implementation of Cancel-button functionality. It works if the user pressed Cancel, when the cell is currently editing has focus and caret. But, after user try to press OK button with the incompleted row, exception window shows and current cell lost focus. Errorprovider appear, but without focus on the cell. In this state CancelEdit doesn''t work. Further validation failed and form won''t close by Cancel. Please help me with this state of window.] Reference: http://www.syncfusion.com/support/Forums/message.aspx?MessageID=15775 Thank you.

1 Reply

AD Administrator Syncfusion Team July 5, 2004 08:44 AM UTC

I think moving the CurrentRecordManager.CancelEdit code from your cancel button handler to the gridGroupingControl Leave event will allow the cancel to work in this case as well as the previous case.
private void cancel_Click(object sender, System.EventArgs e)
{
	 this.Close();
}

private void gridGroupingControl1_Leave(object sender, System.EventArgs e)
{
	if(this.cancel.Bounds.Contains(this.PointToClient(Control.MousePosition))
		&& Control.MouseButtons == MouseButtons.Left)
	{
		if (this.gridGroupingControl1.Table.CurrentRecordManager.IsEditing)
		{
			this.gridGroupingControl1.Table.CurrentRecordManager.CancelEdit();
		}
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon