当前执行某些操作后如何返回上一页 [英] how to go back to previous page after doing some operation in current

查看:124
本文介绍了当前执行某些操作后如何返回上一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在锚标记中使用了此代码

href ="javascript.history.go(-1)返回

当我在当前页面中执行了一些操作后,它会返回我在当前页面中已执行的每项操作.

例如:我有两个页面index.aspx
接下来是xyz.aspx.我已经在xyz.aspx中进行了一些操作.如果我按回去,它应该转到index.aspx.目前,无论我在xyz.aspx中进行了什么操作,它都将返回并最终返回索引.aspx.

i used this code in anchor tag

href="javascript.history.go(-1) BACK

after i do some operation in current page.its going back every operation i have done in the current page.

eg : i have two pages index.aspx
and next is xyz.aspx .i have done some operation in xyz.aspx.if i press back it should go to index.aspx.at present its going back whatever operation i have done in xyz.aspx and at last its coming to index.aspx.

推荐答案

我建​​议不要使用浏览器后退按钮进入上一页.

而是使用您的上位导航/fwd并使用Response.Redirect.
您可以存储当前页面的UrlReferrer(页面的ViewState),然后单击后退"按钮导航到页面的已存储UrlReferrer.

您可以参考以下文章:
http://codebetter.com/petervanooijen/2005/07 /19/a-back-button-for-asp-net-pages/ [
I suggest do not use the browser back button for going for previous page.

Instead use your obwn navigation back / fwd and use Response.Redirect.
You can store the UrlReferrer of the current page (ViewState of the page) and on click of back button navigate to the stored UrlReferrer of the page.

You can refer to following article:
http://codebetter.com/petervanooijen/2005/07/19/a-back-button-for-asp-net-pages/[^]


之所以会这样,是因为您(大概)在做很多事情在XYZ上回发/刷新.如果要使后退"工作,则需要通过AJAX进行这些回发,这样就不会刷新整个页面.

但是,这并不是很好地使用后退按钮.用户希望返回"将他们带回到上一页,并丢弃他们在当前页面上所做的任何事情.您想要的是一个继续"链接或类似的链接,该链接会主动导航回索引(因此历史记录将是索引-> XYZ->索引).
This happens because you''re (presumably) doing lots of postback/refreshes on XYZ. If you want the ''back'' to work, you need to do those postbacks through AJAX so the whole page isn''t refreshed.

However, this isn''t really a good use of the back button. Users expect ''back'' to take them back to the previous page and discard anything they have done on the current one. What you want is a ''continue'' link or similar which actively navigates back to Index (so the history would be Index->XYZ->Index).


商店页面路径在会话中,然后尝试.
store page path in session then try.


这篇关于当前执行某些操作后如何返回上一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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