简体   繁体   English

防止在C#中刷新页面中的button_click事件

[英]Prevent button_click event in page refresh in c#

I want to prevent button_click event in page refresh. 我想防止页面刷新中的button_click事件。 I have searched but can not get any solution relevant for me. 我已经搜索过,但没有任何与我相关的解决方案。 I have found this one: 我发现了这个:
http://www.dotnetspider.com/resources/42823-How-Avoid-Re-Submitting-Data-Page-Refresh.aspx http://www.dotnetspider.com/resources/42823-How-Avoid-Re-Submitting-Data-Page-Refresh.aspx

But i do not need to go inside button_click event in page refresh. 但是我不需要在页面刷新中进入button_click事件。

Response.Redict("") also not relevant here as i am returning label text after succesful button_click. Response.Redict(“”)在这里也不相关,因为我在成功的button_click之后返回了标签文本。

What you looking for is not so simple. 您要找的不是那么简单。

The solution you can use for sure is the Post/Redirect/Get design pattern 您可以肯定使用的解决方案是Post / Redirect / Get设计模式

or use some code that tries to detect the refresh of the page on: 或使用一些尝试检测页面刷新的代码:

http://www.codeproject.com/KB/aspnet/DetectingRefresh_.aspx http://www.codeproject.com/KB/aspnet/DetectingRefresh_.aspx

http://dotnetslackers.com/community/blogs/simoneb/archive/2007/01/06/Using-an-HttpModule-to-detect-page-refresh.aspx http://dotnetslackers.com/community/blogs/simoneb/archive/2007/01/06/Using-an-HttpModule-to-detect-page-refresh.aspx

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

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