keep selected row in grid view

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

On my web form I have a gridview and I allow the user to edit a row but clicking a button above the grid. The Edit button takes them to a edit page with the details of the selected row. When they click 'save' on the Edit page it takes them back to the page.


How can I have the row they selected to edited remain selected when they come back from the edit page?
 
Did you try setting GridView.SelectedIndex property after save?

You will have to store the selected index, so that when they click
save, and go back to the page you can reset the Index Value. You can
use a session like below.

GridView1.SelectedIndex = (Int32)Session["SelectedGridIndex"];
 
Back
Top