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

grid.CurrentCell.MoveTo problem in async mode

In async mode i call grid.CurrentCell.MoveTo and it work but child grid never change. it still display the last selected row.

4 Replies

AD Administrator Syncfusion Team March 31, 2005 01:03 AM UTC

How is grid related to child grid? Are these two GridDataBoundGrids with a parent child relation? Or, are they two GridGroupingControls with a parent child relation? Or are they something else? What do you mean by async mode? Can you post some code snippets showing what you are doing? Or upload a sample project showing the problem you are having?


IG I Gusti Ngurah Wirawan March 31, 2005 01:16 AM UTC

i use two GridDataBoundGrids with parent child relation. the example is like this : protected void MoveTo(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc) { MoveTo(jltaGridDataBound, oDv, oDr, oDc, false); } /// /// To move cursor to a cell of Grid, the method must be invoked /// async to prevent error. /// protected void MoveTo(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc, bool bIsAsync) { if (jltaGridDataBound.CurrentCell.IsInActiveOrDeactivate || bIsAsync) { MoveToHandler oMoveTo = new MoveToHandler(MoveToInvoker); oMoveTo.BeginInvoke(jltaGridDataBound, oDv, oDr, oDc, new AsyncCallback(MoveToCallback), oMoveTo); } else { MoveToMethod(jltaGridDataBound, oDv, oDr, oDc); } } private delegate void MoveToHandler(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc); private void MoveToInvoker(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc) { Invoke(new MoveToHandler(MoveToMethod), new object[] {jltaGridDataBound, oDv, oDr, oDc}); } private void MoveToCallback(IAsyncResult ar) { MoveToHandler oMoveTo = (MoveToHandler)ar.AsyncState; oMoveTo.EndInvoke(ar); } private void MoveToMethod(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc) { try { SetIsInMoveTo(oDv, true); jltaGridDataBound.Focus(); int nPosition = oDv.Find(GetDataRowKeysByDataViewSorts(oDv, oDr)); int nRowIndex = jltaGridDataBound.Binder.PositionToRowIndex(nPosition); int nColIndex = jltaGridDataBound.NameToColIndex(oDc.ColumnName); jltaGridDataBound.CurrentCell.MoveTo(nRowIndex, nColIndex, GridSetCurrentCellOptions.ScrollInView | GridSetCurrentCellOptions.SetFocus); jltaGridDataBound.Refresh(); } catch (System.Exception e) { HandleException(e); } finally { SetIsInMoveTo(oDv, false); } i call MoveTo(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc)function and make MoveToMethod(JLTAGridDataBound jltaGridDataBound, DataView oDv, DataRow oDr, DataColumn oDc) function in async mode. when i call the grid.CurrentCell.MoveTo in those function it select the row but item in child grid still same with last selected row.


IG I Gusti Ngurah Wirawan March 31, 2005 10:01 AM UTC

its kind like this, 1. when i call MoveToMethod directly the current cell point the right place and items in child grid are correct and not active but row that are selected differ 2. when i use async mode that call MoveTo function the selected row is correct with the current cell but items in child grid are differ.


AD Administrator Syncfusion Team March 31, 2005 11:17 AM UTC

In 1), do you see an exception listed in your output window when you try this call? If all that is wrong with 1 is that the current row is not selected, you can try calling grid.Selections.SelectRange(GridRangeInfo.Row(grid.CurrentCell.RowIndex), true); after moving the current cell.

Loader.
Live Chat Icon For mobile
Up arrow icon