I have two buttons which move the selected row up or down one visibleIndex position in the gird. Once the grid refreshes its view and the row has moved, I no longer have any items in the selected.row collection. The end result I need to achieve is to keep the original selected row as selected. Is this possible?
Dave K.
Hi Dave,
How exactly are you moving the row?
I am using a UltraDataSource to bind data to my grid. I have a collection of objects that are being used to create ultradatasource rows and then this datasource populates the grid values via the udsHealthIssue_CellDataRequested event calls.. Upon click of the up arrow, I swap the myObjectItem.DispalySequence values of the item selected and the item in the visiblePosition about it. I then clear my datasource rows and recreate them. This triggers udsHealthIssue_CellDataRequested event to populate the values in the grid rows.
Thanks for your input. After looking over my code again, I realized I did not need to update the entire datasource, but only needed to call the sort on my grid to get the grid to draw the rows correctly, which also allows the grid to maintain the selected row.
If you are resetting the data source, then this will be very difficult to do. Resetting the data source means that all the rows in the grid are destroyed and a completely new set of rows are created to represent the new data. So you can't get the new selected row until after the process has completed. Maybe you could store the grid's ActiveRow.Index before you move the row, then use the index - 1 to select the row that is now in that position.