Let’s say I have a detail record page that loads a single record (the user would have chosen this record from a GridView). The users want Next/Previous button functionality so they don’t have to hit the back button to go back to the grid (the grid has a lot of records so they “forget” what position they were at); basically like an old MS Access record form with the navigation buttons at the bottom (although I’m only interested in Next/Previous, I don’t need first/last/new).
Is there a relatively simple way to accomplish this short of stuffing the entire list of objects from the grid into the ViewState or Session (and even then, it’s not ordered so I’d have no way of knowing what the “next” record is)? We do not want a Master/Detail type of setup where the detail record is below the grid, it must be a separate page.
You could setup a FormView in another page and then navigate to the page from a hyperlink in your grid with the ID in the querystring for the FormView’s DataSource’s SelectMethod input parameter like so:
This uses JavaScript to open a new window with querystring attached to the url. The GetSelectedRow method is a JavaScript function that you would use to identify the id for the row that was clicked — hence the Eval method.
On your details page your DataSource’s SelectParameter:
Get your data and bind it to the FormView.
The FormView allows you to display a collection of records one at time using a pager and it has a PagerTemplate to customize the Pager.