我怎样才能得到相同的页面,浏览器的后退按钮的点击 [英] how can i get the same page with the click of back button of browser
问题描述
我使用asp.net使用C#在我的aspx页面我有一个更新面板在此面板中我有一些其他网站的链接,这是在同一个窗口中打开。点击这些链接我,当我找回了通过浏览器的后退按钮我没有得到更新面板上相同的结果后...
i am using asp.net with c# in my aspx page i have an update panel in this panel i have some links to other sites, which is open on the same window. after clicking on these links me when i am getting back through browser's back button i am not getting the same results on the update panel...
推荐答案
我有以下文章实现相同的,如果您需要进一步的帮助,PLZ让我知道,我会提供code卡盘
I have implement the same with the following Article, If you need further help, Plz let me know, I will provide chucks of code
的http://rchern.word$p$pss.com/2008/05/11/updatepanel-backforward-browser-navigation/
首先,你必须启用ScriptManager的历史EnableHistory =真
在这个例子中,我们维修器材gridview的分页,当用户浏览器后退按钮
你有你的网页第一次加载后添加历史点。
First of all you have to Enable ScriptManager history EnableHistory="true"
In this example we are maintaing gridview paging, When user browser back button
You have add history point after your page first time loads.
private void AddHistoryPoint(String key, String value, String tile)
{
ScriptManager scm = ScriptManager.GetCurrent(this.Page);
if ((scm.IsInAsyncPostBack == true) && (scm.IsNavigating != true))
{
if (pageState == null)
{
NameValueCollection pageState = new NameValueCollection();
}
if (pageState[key] != null)
{
pageState[key] = value;
}
else
{
pageState.Add(key, value);
}
scm.AddHistoryPoint(pageState, tile);
}
}
protected void grid_PageIndexChanged1(object sender, EventArgs e)
{
AddHistoryPoint("pi", grdProject.PageIndex.ToString(), "Page Index- " + (grdProject.PageIndex + 1).ToString());
}
在这里你必须处理的ScriptManager导航事件
here you have to handle ScriptManager Navigate Event
protected void ScriptManager1_Navigate(object sender, System.Web.UI.HistoryEventArgs e)
{
if (e.State != null)
{
if (e.State["pi"] != null)
{
grid.PageIndex = Convert.ToInt32(e.State["pi"]);
}
}
}
这篇关于我怎样才能得到相同的页面,浏览器的后退按钮的点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!