The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am using GridControl. I just noticed while processing CurrentCellMoving event if I set GridCurrentCellMovingEventArgs.Cancel to true, the event is triggered again for the same current cell.
Should it be considered as an issue, or it works as designed?
I forget to mention that I am using version 5.102.0.51 against .NET 2.0 in VS 2005
SASaravanan A Syncfusion Team June 16, 2007 01:47 AM UTC
Hi Alex,
We could see this issue here. When we try to navigate between the cells it will fire the CurrentCellMoving event and if we set the e.Cancel to true, it will stop the moving and the CurrentCellMoving event will not raise again. But if we try to navigate using mouse it will raise the CurrentCellMoving event to set the clicked cell as the CurrentCell. In this case if set the e.Cancel it will stop moving the CurrentCell, but it will still try to scroll the grid to make the clicked cell fully visible, while doing this it is raising the CurrentCellMoving event again with different e.Option argument (GridSetCurrentCellOptions.ScrollInView). Now, you can avoid the execution of your code twice by adding some conditional logic using this argument.
Here is the modified code snippet of your CurrentCellMoving event handler. void m_Grid_CurrentCellMoving(object sender, GridCurrentCellMovingEventArgs e) { GridCurrentCell cc = m_Grid.CurrentCell; if (!(cc.MoveFromRowIndex == cc.MoveToRowIndex && cc.MoveFromColIndex == cc.MoveToColIndex)) { if (e.Options == GridSetCurrentCellOptions.ScrollInView && !cc.MoveToDone) { e.Cancel = m_Closing; return; } } if ((cc.RowIndex == m_ForcedRowIndex) && (cc.ColIndex == m_ForcedColIndex) && m_Grid.CurrentCell.HasCurrentCell) { OutputLine("Cell Moving!"); // // write your code here to do the required task // e.Cancel = m_Closing; } }
Best Regards, Saravanan
Need More Help?
Get personalized assistance from our support team.