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

How to find first enabled cell in grid...

When my app opens, I''d like to set focus to the first editable cell in the grid. I presume that CurrentCell.MoveTo is the appropriate method, but I don''t know how to identify the row/column of the first enabled cell. Ideas? Thanks, s.s.

2 Replies

AD Administrator Syncfusion Team July 28, 2004 10:37 PM UTC

Do you want to look through the row or down the column? You have some choices to consider. You can always loop though cells checking grid[row,col].Enabled until your find one, and then use grid.CurrentCell.MoveTo to position that currentcell. If you want to look across the first row, and you know the first row has at least one enabled cell, you can use code like this to find it without looping. this.gridControl1.CurrentCell.MoveTo(1,0); this.gridControl1.CurrentCell.MoveRight(); You can do the something similar looking down column 1. But if you do not have information to know there is at least one enabled cell in a row or column, then I think you would have to loop through the rows and columns in the order you decide, looking for an enabled cell.

AD Administrator Syncfusion Team July 29, 2004 01:48 AM UTC

Thanks, Clay. Indeed, the row and column of the first enabled cell varies frequently. I was hoping there might be a better way than that (some usage or variation of QueryNextEnabledCell) that would do the trick. Since I set the enabled attribute during the grid''s load logic, I just decided to save the location of the first enabled cell. Thanks again. s.s.

Live Chat Icon For mobile
Up arrow icon