Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

Prevent firing button click event when refreshing the page

5.00/5 (1 vote)
10 Oct 2011CPOL 23.8K  
Prevent firing button click event when refreshing the page
During development we can come across this issue. I found many solutions about this issue. However i found an easy solution for this.

I add the following line of code in my button click event and it resolves the problem.

C#
Page.Response.Redirect(Page.Request.Url.AbsoluteUri);


It prevents firing the button click event when we refresh the page.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)