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
close icon

CurrentCell.MoveTo on RowLeave event

Hi, Using GDBG, on "RowLeave" event (of a new row) I have a logic which checkes a certain column value before leaving the row. If a valid value is missing, I would like to move to the invalid cell and set it as the active cell. In addition I''m canceling the event. The problem, "MoveTo" seems to do nothing?! It''s simply ignored. Why? How can I do it? Here is a pesudo code example of what I''m trying to do: void OnRowLeaveEvent(EventParams e) { //1.Test for cell valid value //2.An invalid value is found //2.Try and move to the invalid cell this.grid.CurrentCell.MoveTo(invalidCellRowindex,invalidCellColindex); e.Cancel = true; } Thanks

1 Reply

AD Administrator Syncfusion Team December 15, 2004 09:44 AM UTC

You can try handling these events to see if this will will for you.
private int moveToCol = -1;
private int moveToRow = -1;
private void gridDataBoundGrid1_RowLeave(object sender, GridRowEventArgs e)
{
	if(somethingIsBad)
	{
		this.gridDataBoundGrid1.BeginUpdate();
		this.moveToCol = badColumnIndex;
		this.moveToRow = e.RowIndex;
	}
}

private void gridDataBoundGrid1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	if(this.moveToCol > -1)
	{
		int col = this.moveToCol;
		this.moveToCol = -1;
		this.gridDataBoundGrid1.EndUpdate();
		this.gridDataBoundGrid1.CurrentCell.MoveTo(this.moveToRow, col);
		
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon