In my ASP.Net Web Site I have a button.When I click the button and then reload the page via browser,the click event of the button fires.Where is a problem,please help me.
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
This is by design. When you click a server side button (with the
runat="server"
attribute), a click will cause a postback and the button click event will fire.If you want some client side behaviour, you need to use the
OnClientClick
attribute, as described in this MSDN article (How to: Respond to Button Web Server Control Events in Client Script).I had the same issue and it was solved by putting the button as asp:AsyncPostBackTrigger of the updatePanel.
It's because clicking that button sends a POST request to your page. The POST data is kept in the http headers and when you refresh, it's sent again to server.
Your browser should warn you when you try to refresh the page.
If you want to refresh Part of your page then put the control inside the
UpdatePanel
if the control causesPostBack
the easiest way to solve this issue is to redirect your page to some url or refresh your current page using Response.Redirect(Request.RawUrl);
If this is really important for someone, then they can refresh the page again through a Response.Redirect(). This is the easiest solution that I have been able to find.