简体   繁体   English

ASP.NET C#页面重新提交

[英]Asp.net c# Page resubmission

I have some problem that when I save button show the JavaScript message saved but when next time browser refresh button click its automatically redirect save button work. 我有一个问题,当我保存按钮时显示保存的JavaScript消息,但是下次浏览器刷新按钮单击时,其自动重定向保存按钮会起作用。

Remember this things that when I press save button its show message box in JavaScript message and then page redirect this own page. 记住这一点,当我按下保存按钮时,它会在JavaScript消息中显示消息框,然后页面重定向此页面。

The simplest solution is to do a Response.Redirect("samepage") from your server side submit button event after processing your request. 最简单的解决方案是在处理您的请求后,从服务器端提交按钮事件中执行Response.Redirect(“ samepage”)。 and pass parameter in the query string. 并在查询字符串中传递参数。 or go to save the value in viewstate. 或将其保存在viewstate中。

you can check this answer here to prevent form from re-submission : 您可以在此处检查此答案以防止重新提交表单:

Prevent Form Resubmission in ASP.Net (without redirecting to myself) 防止在ASP.Net中重新提交表单(无需重定向到我自己)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM