gridview selection error

When I select a record from my gridview I update a detailsview with:

DetailsView1.PageIndex = GridView1.SelectedIndex

That works fine for all the records on the first page (paging enabled), but if I choose my second page, it selects the data from the first page at the same location.

(e.g. page 1 record 1 name = "John" clicking select populates the details view with "John". If I go to page 2 and select the record at the top of the grid view "John" is selected and detailed again.)



Answer this question

gridview selection error