Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 ASP.NET
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.
Posted 24-Oct-12 23:20pm
Edited 24-Oct-12 23:49pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
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!
--Amit
  Permalink  
Comments
braj mohan sharma at 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 at 25-Oct-12 5:36am
   
Are you using server side button click event to open the popup?
Teju MB at 25-Oct-12 7:08am
   
Good going Amit..! my 5 !
_Amy at 25-Oct-12 7:08am
   
Thanks Teju. :)
Teju MB at 25-Oct-12 7:09am
   
Under E-underwrite Code project too ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try to put on the Page load !IsPostback () { //whatever codes you're doing in here }
  Permalink  
Comments
braj mohan sharma at 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)

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 220
3 Praneet Nadkar 197
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 25 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100