防止回发出现在历史记录中

发布于 2024-07-04 18:38:30 字数 498 浏览 3 评论 0原文

我有一个页面,我在其中提交一些数据,然后返回到原始表单并显示“保存成功”消息。 然而,用户希望能够通过单击浏览器的“后退”按钮返回到他们所在的上一页(其中包含搜索结果)。 但是,由于回发,当他们单击“后退”按钮时,他们不会转到上一页,而只是转到同一页面(但处于先前的状态)。 我读到启用 SmartNavigation 将解决这个问题(回发出现在历史记录中),但是它已被弃用。 “新”最佳实践是什么?

*编辑 - 我添加了一个 ScriptManager 控件,并将按钮包装在 UpdatePanel 中,但是现在我收到以下错误:

Type 'System.Web. UI.UpdatePanel' 没有名为 'Button' 的公共属性

我缺少引用吗?

*忽略上面的编辑,我只是​​忘记添加 < 内容模板> UpdatePanel 部分:P

I have a page where I submit some data, and return to the original form with a "Save Successful" message. However, the user would like the ability to return to the previous page they were at (which contains search results) by clicking the browser's "Back" button. However, due to the postback, when they click the "Back" button they do not go to the previous page ,they simply go to the same page (but at its previous state). I read that enabling SmartNavigation will take care of this issue (postbacks appearing in the history) however, it has been deprecated. What's the "new" best practice?

*Edit - I added a ScriptManager control, and wrapped the buttons in an UpdatePanel, however now I'm receiving the following error:

Type 'System.Web.UI.UpdatePanel' does not have a public property named 'Button'

Am I missing a reference?

*Disregard the above edit, I simply forgot to add the < ContentTemplate > section to the UpdatePanel :P

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

长安忆 2024-07-11 18:38:31

如果可能的话我会避免。 更好的解决方案是在“保存成功”屏幕上设置一个按钮,让他们返回搜索结果。

ajaxy 保存等问题在于您违反了用户期望的“返回”规则。 该用户可能希望通过“后退”按钮返回到“搜索”页面,但其他用户可能希望单击“后退”会将他们返回到“添加/更新”页面。 因此,如果另一个用户尝试更新某些内容,单击“保存”,然后“哎呀,我忘记了更新中的某些内容”,他们会单击返回,现在他们会看到搜索结果,而不是预期的更新页面。

I would avoid if possible. A better solution would be to have a button that just returns them to their search results on the "Save Successful" screen.

The problem with the ajaxy saving and such is that you violate the "Back" rules that users expect. This user might want the Back button to go back to the Search page, but other users might expect that clicking Back would return them to the Add/Update page. So if another user tries to update something, clicks save, and then "woops, i forgot something on the update", they'll click back, and now they're at search results, instead of the expected Update page.

绿光 2024-07-11 18:38:30

If you put your "Save" button in an UpdatePanel, the postback will not show in the users history.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文