In my web app I has a GridView and some other control. User is allow to sort and filter the grid view.They also allow to click the link and go to other page.Then they also can go to other more pages. But when they cum back to the first gridview page. The grid is same as what they left the page. For example paging ,sorting and other .
I found a solution about this . But I not really understand.
http://www.codeproject.com/Articles/7655/Persisting-the-state-of-a-web-page
Here is my coding WebForm1.aspx
protected void Button2_Click(object sender, EventArgs e)
{
PersistentStatePage abc = new PersistentStatePage();
abc.RedirectSavingPageState("WebForm2.aspx");
}
WebForm2.aspx
protected void Button1_Click(object sender, EventArgs e)
{
PersistentStatePage.RedirectToSavedPage("WebForm1.aspx", true);
}
Can anyone guild me some example?
That codeproject article is not really meant for this sort of scenario. It is about saving viewstate to a secure, on server location rather than sending it all to the user in a hidden input field which leads to a lot of bloat.
The best way to go about this would be session.
Create a custom object to store the info you want to persist and put it in session.
Check out the following for an article about using session http://asp.net-tutorials.com/state/sessions/
Then you don’t have to worry about passing the details around all the other pages.