Click here to Skip to main content
11,924,800 members (56,797 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#2.0 C# 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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!
braj mohan sharma 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?
Teju MB 25-Oct-12 7:08am
Good going Amit..! my 5 !
_Amy 25-Oct-12 7:08am
Thanks Teju. :)
Teju MB 25-Oct-12 7:09am
Under E-underwrite Code project too ?
Rate this: bad
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 }
braj mohan sharma 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151125.3 | Last Updated 25 Oct 2012
Copyright © CodeProject, 1999-2015
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