Hi All,
I have a win grid with a max of 5000 rows at any given point of time. So the user will select a row on the grid and hit on the tool bar which invokes a winform. when the user x out of the form, the grid will be refresh automatically by getting a datasource from sql. But after the refresh I want the same row to be highlighted/selected and if the row # is say 4999, i want the scroll bar to navigate to that row automatically, so that the row is right now visible. Can we achieve this? This makes the user's life easy.
And by the way the grid has a column which is like primary key.
Thanks in advance.
Swetha.
Hi Swetha,
Once you set the grid's DataSource, any existing rows in the grid are destroyed and a whole new set of rows are created for the new data. So you cannot store the row and re-select it.
What you would have to do is store some information from that row like a primary key value. Then you would have to loop through the grid rows to find the row you want and make it the ActiveRow.
If you're keeping track of the selected row, the documentation link below might give you some direction to achieve what you're looking for.
http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=WinGrid_Change_the_Active_Row.html