Click here to Skip to main content
15,663,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to stop the recurrence of event at page refresh in asp page.
when we click on some button it does its click event but after that when we refresh the page then it also clicked automatically. How can It may be solved ?

Browser should not store my previous click event.
Updated 24-Oct-12 22:49pm

If u have acess to the Data Layer (database), u can write a stored procedure, which does the checking, whether the record exists, and do the insert (or skip) accordingly and return, the existence in a way u prefer.
You may do that as you do it now in the code, but it may not be the "standard coding".
"is Not" is inside a string and is doing nothing other than being inside a string, in C# side. It comes into play one passed to Database server (interprets it as SQL statements)

Or you can also see Page Refresh Causes Duplicate POST in ASP.NET Applications[^]

Hope it helps!
Share this answer
Braj_12 25-Oct-12 5:31am    
I am not using any database. I am calling popup, that should be called only once.On page refresh it should not be called.
_Amy 25-Oct-12 5:36am    
Are you using server side button click event to open the popup?
The Doer 25-Oct-12 7:08am    
Good going Amit..! my 5 !
_Amy 25-Oct-12 7:08am    
Thanks Teju. :)
The Doer 25-Oct-12 7:09am    
Under E-underwrite Code project too ?
Try to put on the Page load !IsPostback () { //whatever codes you're doing in here }
Share this answer
Braj_12 25-Oct-12 4:41am    
I know this...but browser is still asking for Retry or cancel your event again.

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900