Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Button clicks everytime I refresh screen???...

Reply
Thread Tools

Button clicks everytime I refresh screen???...

 
 
Trint Smith
Guest
Posts: n/a
 
      02-23-2004
What can I do to stop the last button pressed on a page to click when I
refresh the screen?...I created the webproject with visual studio .net
2003 in VB.net.
Thanks,
Trint

..Net programmer
http://www.velocityreviews.com/forums/(E-Mail Removed)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-23-2004
Can you elaborate, I'm not clear with what you want ;P

"Trint Smith" <(E-Mail Removed)> wrote in message
news:e2hodAl%(E-Mail Removed)...
> What can I do to stop the last button pressed on a page to click when I
> refresh the screen?...I created the webproject with visual studio .net
> 2003 in VB.net.
> Thanks,
> Trint
>
> .Net programmer
> (E-Mail Removed)
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
 
Trint Smith
Guest
Posts: n/a
 
      02-24-2004
Ok,
For example, I click 'add' to an amount in a textbox...well, if I click
'refresh' in i explorer, it adds again without me clicking add!! Also,
some of my buttons refresh the screen??? What can I do?
Thanks,
Trint

.Net programmer
(E-Mail Removed)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-24-2004
Trint,
The refresh button on IE, is there by design and behaves like that to comply
with the standards set for browser vendors. That is hitting the refresh
button will re-try the previous request you made on the server, in your case
you clicked a button last which will get fired again. The applications you
write should already keep in mind this kind of behavior and try and handle
this yourself gracefully.
1. You can either redirect to a new page --this solves issues when you have
a form that adds data to the database and hitting refresh could add
duplicate data, even though they should not solely depend on this and there
are many other ways to work around this however this does not seem to be
your case.

2. You can track to see if that particular button was already clicked by
setting a flag the first time it were clicked and then do nothing because
now you know its not the button being clicked but a refresh. Use a session
variable to track. Trying to use viewstate to set a flag wont work here
because the postback to the server caused by the refresh button will
postback the same identical data that was posted back last.

In short if someone hit refresh they probably want to refresh the page, that
is resubmit the page and perform the last action they had done, in your case
if they hit refresh after clicking your add button, then they are making
that last request again ;P

Note this is by design and there is not much you can do to prevent this but
your going to have to try and expect this and handle it as gracefully as
possible.

In your case neither 1 or 2 will solve --I'd just let the calculation to add
up anyway. Still I havent been able to reproduce your problem. Your saying
that when the refresh is hit your items are recalculated and a new value is
produced ?
If your making the calculation based on user data that you are collection in
the textbox and then hitting the add button you perform a calculation based
on that . . then the data in the textbox is the same data they had when they
first made the request when clicking the add button so the data produced
after the refresh is the same --how can this be a problem.

It adds the data but the value produced should be the same value anyway so
no problem here. I'm not clear with what you mean by some of your buttons
refresh the screen. I repeat again, so far in your case I dont see how the
refresh button can case your form to give you unexpected behavior.

"Trint Smith" <(E-Mail Removed)> wrote in message
news:OlPqQ7m%(E-Mail Removed)...
> Ok,
> For example, I click 'add' to an amount in a textbox...well, if I click
> 'refresh' in i explorer, it adds again without me clicking add!! Also,
> some of my buttons refresh the screen??? What can I do?
> Thanks,
> Trint
>
> Net programmer
> (E-Mail Removed)
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Trint Smith
Guest
Posts: n/a
 
      02-24-2004
This is an auction site and if they refresh, they bid + $$ again.
Thanks,
Trint

.Net programmer
(E-Mail Removed)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code is reexecuted when the user clicks Refresh Nathan Sokalski ASP .Net 5 01-20-2007 06:04 AM
When user clicks BACK, force refresh and auto scroll. Badass Scotsman Javascript 1 04-27-2006 01:13 AM
Refresh when user clicks back button morc Javascript 4 02-14-2006 01:54 PM
An 0E : VMM(12) Blue screen error everytime i press 'start button' Morph Computer Support 1 12-08-2004 02:20 PM
Clicks and double-clicks PontiMax ASP .Net Datagrid Control 2 07-14-2004 11:00 AM



Advertisments