单击按钮时如何在正确的位置导航上一页? [英] how to navigate previous page at exact place when button clicked?

查看:85
本文介绍了单击按钮时如何在正确的位置导航上一页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在同一页面中没有多少报告.在另一页面中有返回报告"按钮.该按钮正在重定向页面.单击该按钮时,我需要回到以前的位置.我该怎么办?

有人请帮我提供代码..

I have few reports in the same page..and a "BACK to Reports" button in another page..The button is redirecting the page .When button is clicked I need to get back to same place as it was earlier..How can i do this ?

someone pls help me with the code..

推荐答案

1.在报告页面中,要返回的位置请使用anchors ,如下例所示;
< h2><名称="1">您的第一份报告</a></h2>
...
< h2><名称="2">您的第二个报告</a></h2>
...
2.然后,当您启动报告时,您还应该发送(或缓存)参数作为锚名称,例如,如果您启动第二个报告,您还应发送(或缓存)值"2".
3.最后,通过使用上面的参数,通过在URL的末尾添加一个#2",最后使用返回的参数来构建您的后退按钮URL.
1.In your reports page use anchors in places where you want to come back, like in the next example;
<h2><a name="1">Your 1st Report</a></h2>
...
<h2><a name="2">Your 2nd report</a></h2>
...
2.Then when you start a report your should send (or cache) as parameter also the anchor name, for example if you start the 2nd report you should send (or cahce) also the value "2".
3.Finally build your URL for back button by using also the param from point above by adding a "#2" at the end of the URL in the case of example from point 2 above.


全局声明
静态字符串prevPageUrl = String.Empty;
将其写在page_load事件中
prevPageUrl = Request.UrlReferrer.ToString();

在btn_click()
中 Response.Redirect(prevPageUrl);

引用此链接,您还可以了解获得以前的url的多少方法
http://www.dotnetcurry.com/showarticle.aspx?ID=89
declare globally
static string prevPageUrl = String.Empty;
to write this in page_load event
prevPageUrl = Request.UrlReferrer.ToString();

in btn_click()
Response.Redirect(prevPageUrl);

refer this link also you can get idea how many ways to get previous url
http://www.dotnetcurry.com/showarticle.aspx?ID=89


这篇关于单击按钮时如何在正确的位置导航上一页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆