Question

So I have a gridview which lists a bunch of jobs.

On this gridview I have paging enabled, which works fine.

When I hover over the Page Numbers i.e 1,2,3,4,.... the following is displayed

javascript_DoPostBack('C100PlaceHolderGrievew','Page$1')

Now my problem is as follows.

When I click on one of the hyperlinks in this list i go to an edit details page. Once the user clicks on save I redirect the user back to the List page with gridview.

What I would like to implement is that the gridview remembers what page they came from i.e Page 2.

I know i can Use PageIndex to set this but Im not sure how to send across the value of "page" of the gridview so i can this.

Was it helpful?

Solution

I would save the needed variables in the Session state of the page. When you load the page you could have a boolean which states whether you have come from the edit page set to true, and if this is the case another session variable recording the page from where you came?

So... on the way out set the session variable for the page currently selected using page index, then 2 new session variables for passing back to the page.

sEdited = Session["Edited"].ToString();
sPage = Session["PageToDisplay"].ToString();

Then set the Page index from this once parsed from the string?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top