I am new to AJAX and AddHistoryPoint, so bear with me.
I have a GridView with a LinkButton in it. When the user clicks the link they navigate to another page using Response.Redirect. When they click the back button in the browser they come back to a page without the GridView rather than the page with the results as they were. I gather this is common.
I've found examples with sorting and paging, but I am not using that, so I'm not sure what I'm supposed to use during the AddHistoryPoint to get it to remember the state of the GridView.
It hits the line of code with AddHistoryPoint, but it's not actually adding it. No matter what I put in for the title it doesn't show up in the history.
What I have done is:
1) Set the ScriptManager EnableHistory to True
2) Add the following code:
protected void MainScriptManager_Navigate(object sender, HistoryEventArgs e)
// Get GridView PagIndex from history
string pageIndex = e.State["PageIndex"];
gv_report.PageIndex = 0;
gv_report.PageIndex = Convert.ToInt32(pageIndex);
3) Added the following code to the GridView RowCommand:
if (MainScriptManager.IsInAsyncPostBack && !MainScriptManager.IsNavigating)
MainScriptManager.AddHistoryPoint("pageIndex", gv_report.PageIndex.ToString(), "Reports");
Response.Redirect("org.aspx?oid=" + Encryption64.EncryptQueryString(dk.Values["organization_id"].ToString(), ConfigurationManager.AppSettings["encryptionString"]));