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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CurrentCell.MoveTo on RowLeave event

Thread ID:

Created:

Updated:

Platform:

Replies:

22545 Dec 15,2004 09:06 AM UTC Dec 15,2004 09:44 AM UTC WinForms 1
loading
Tags: GridControl
Gil Kalo
Asked On December 15, 2004 09:06 AM UTC

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

Administrator [Syncfusion]
Replied On 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);
		
	}
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;