views:

45

answers:

1

Hi after i sort my gridview, when i want to edit a row the selected row is completely wrong.

what can i do?

+1  A: 

After sorting, try setting the SelectedIndex property to -1.

Alternatively, try using the SelectedDataKey property (check this link for details). Note that you may have to write your code in the PreRender event for the data keys to be set.

Andy West
i tried , not working.
Grant83
Please see my edit - I added an alternative to try.
Andy West
In a few forums, it's mentioned about datarowbound to fix this problem, but i can't figured out why
Grant83