views:

13

answers:

1

Hi there,

I have a gridview, getting data from sql server, there is an Edit link to get the detailed information for example, for a user from database.

this link open a new page with detailed information and when I click the updated button,I want to go back to the same page with that users informaton.

I set the page size to 10, it means I can see only 10 users per page,and if I click the edit link on page 25,and update the users info, I want to go back to page 25.

Should I use viewstate or gridview has any commnad to go back to the same page? the code is written in ASP.net C# sqlserver,

Thanks in advance

A: 

The gridview control will not provide this functionality.

Viewstate will only help persist data between postbacks of the same page (primarily).

Session state could be used to save the pagesize/pagenumber details onclick of the grideview edit before forwarding to the edit page. This can be re-processed back on loading of the view page.

My preference would be to store the values in the querystring. So on clicking edit, the pagesize and number are passed to the edit page (i.e edit.aspx?itemid=1&psize=10&pindx=25).

Then on finishing edit, the page number and size are based back to the view page for processing (view.aspx?psize=10&pindx=25)

Adam Jenkin