防止回发出现在历史记录中
我有一个页面,我在其中提交一些数据,然后返回到原始表单并显示“保存成功”消息。 然而,用户希望能够通过单击浏览器的“后退”按钮返回到他们所在的上一页(其中包含搜索结果)。 但是,由于回发,当他们单击“后退”按钮时,他们不会转到上一页,而只是转到同一页面(但处于先前的状态)。 我读到启用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果可能的话我会避免。 更好的解决方案是在“保存成功”屏幕上设置一个按钮,让他们返回搜索结果。
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.
如果您将“保存”按钮放在 UpdatePanel< /a>,回发不会显示在用户历史记录中。
If you put your "Save" button in an UpdatePanel, the postback will not show in the users history.