Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
444
How do I avoid scrolling which focuses to last column whenever I update the row in a grid?
posted

I have the following statement  in a for loop in my code to update a row in the grid.

                grdRow.Cells.Item(pAttr.ColumnName).SetValue(pAttr.Value, True)

 Where grdRow is  Infragistics.Win.UltraWinGrid.UltraGridRow

It perfectly updates the specified row in the grid. But for every iteration the focus moves cell by cell. So at the end of the loop my grid will be focusing the last column (or last cell of the updated row). So the scroll bar moves horizontally to the end focusing the last column.

 How do I get back the focus to the first row and first column (As how it is intially focused before the update)?

 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

         I don't think this code should be changing the ActiveCell in the grid... unless maybe it's because you are passing in True for the secod parameter. This probably simulates editing a cell as though it was done by the user. If you don't want the grid to scroll, I'd recommend passing in False. 

        You can scroll the grid in a number of ways. Setting the ActiveRow or ActiveCell will scroll that row/cell into view. You can also use grid.ActiveRowScrollRegion methods like ScrollRowIntoView or the FirstRow property. 

Children