[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

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

Trint Smith

2/23/2004 9:01:00 PM

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
trintsmith@hotmail.com

*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!
7 Answers

Alessandro Zifiglio

2/23/2004 10:58:00 PM

0

Can you elaborate, I'm not clear with what you want ;P

"Trint Smith" <trintsmith@hotmail.com> wrote in message
news:e2hodAl%23DHA.1672@TK2MSFTNGP12.phx.gbl...
> 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
> trintsmith@hotmail.com
>
> *** Sent via Developersdex http://www.develop... ***
> Don't just participate in USENET...get rewarded for it!


Trint Smith

2/24/2004 12:41:00 AM

0

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
trintsmith@hotmail.com

*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!

Alessandro Zifiglio

2/24/2004 10:46:00 AM

0

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" <trintsmith@hotmail.com> wrote in message
news:OlPqQ7m%23DHA.1700@TK2MSFTNGP12.phx.gbl...
> 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
> trintsmith@hotmail.com
>
> *** Sent via Developersdex http://www.develop... ***
> Don't just participate in USENET...get rewarded for it!


Trint Smith

2/24/2004 5:55:00 PM

0

This is an auction site and if they refresh, they bid + $$ again.
Thanks,
Trint

.Net programmer
trintsmith@hotmail.com

*** Sent via Developersdex http://www.develop... ***
Don't just participate in USENET...get rewarded for it!

PINKO

3/16/2009 5:07:00 PM

0


"rilke" <rilke@paxienxia.com> wrote in message
news:Xns9BD064661F40Drilkepaxienxiacom@62.141.42.83...
> Dandole consejos a Chavez de como hacer la nigocia?
> Ocupate de tu propio pais que esta quebrado de A a Z!
>
> sinceridades,
> r.
>
> PS, Chavez = negro de primera
> Obama = negro de cuarta
>
>

Que sabras vos, loka!

El dia que el gordo Chavez pueda hacer algo asi, entonces hablamos.

http://tinyurl....

PINKO
>
>
>
> donquicovelez <donquicovelez@gmail.com> wrote in news:d1cf2b96-8b1e-
> 473e-aed8-f9f40d7570fe@w34g2000yqm.googlegroups.com:
>
>> On 15 mar, 13:00, rilke <ri...@paxienxia.com> wrote:
>>> Que genio El Negro!
>>> Cada dia lo admiro mas!
>>>
>>>
>>
>> no sería mejor que hiciera un plan de financiamiento a peqeñas
>> empresas para que proliferaran en el país y así haría mil pequeños
>> empresarios que emplearían a la mitad de su familia y estos a su vez
>> le comprarían los alimentos a miles de familias, en lugar de
>> enriquecer su ego y megalomanía con su nombre y haya que mamarle el
>> guevo '? es que él piensa que se va a quedar por mil anios ? tirano al
>> fin ? porqué no ponerle el nombre de cada propietario, darle
>> financiamientos, ayudarlos, asesorarlos como empresarios
>>
>> nó, pero hay que ponerle el nombre del emeprador hugo, quizás una
>> estatua...... cosas de tiranos.
>>
>>
>> encima éste pendejo dice que lo admira.
>


Bufozzo

3/16/2009 5:17:00 PM

0


"PINKO" <ngsemail2005withoutthis@yahoo.com.ar> escribió en el mensaje
news:gpm109> Que sabras vos, loka!
>
> El dia que el gordo Chavez pueda hacer algo asi, entonces hablamos.
>
> http://tinyurl....
>

El tipo está "in the mood" ! ! ! !
Dentro de unos pocos meses el Lexotanil no lo va a dejar ni embocar los
papeles en el cesto de la oficina.

Sr Bufozzo


rilke

3/16/2009 7:48:00 PM

0

"PINKO" <ngsemail2005withoutthis@yahoo.com.ar> wrote in news:gpm109$lqs
$1@news.motzarella.org:

>
> "rilke" <rilke@paxienxia.com> wrote in message
> news:Xns9BD064661F40Drilkepaxienxiacom@62.141.42.83...
>> Dandole consejos a Chavez de como hacer la nigocia?
>> Ocupate de tu propio pais que esta quebrado de A a Z!
>>
>> sinceridades,
>> r.
>>
>> PS, Chavez = negro de primera
>> Obama = negro de cuarta
>>
>>
>
> Que sabras vos, loka!
>
> El dia que el gordo Chavez pueda hacer algo asi, entonces hablamos.
>
> http://tinyurl....


Tranquila vieja, no es una competencia, cuarta no puede competir con
primera, ademas ese grone necesita un poco de sopa, parece esqueleto de
halloween.

sinceridades,
r.




>
> PINKO
>>
>>
>>
>> donquicovelez <donquicovelez@gmail.com> wrote in news:d1cf2b96-8b1e-
>> 473e-aed8-f9f40d7570fe@w34g2000yqm.googlegroups.com:
>>
>>> On 15 mar, 13:00, rilke <ri...@paxienxia.com> wrote:
>>>> Que genio El Negro!
>>>> Cada dia lo admiro mas!
>>>>
>>>>
>>>
>>> no sería mejor que hiciera un plan de financiamiento a peqeñas
>>> empresas para que proliferaran en el país y así haría mil pequeños
>>> empresarios que emplearían a la mitad de su familia y estos a su vez
>>> le comprarían los alimentos a miles de familias, en lugar de
>>> enriquecer su ego y megalomanía con su nombre y haya que mamarle el
>>> guevo '? es que él piensa que se va a quedar por mil anios ? tirano
al
>>> fin ? porqué no ponerle el nombre de cada propietario, darle
>>> financiamientos, ayudarlos, asesorarlos como empresarios
>>>
>>> nó, pero hay que ponerle el nombre del emeprador hugo, quizás una
>>> estatua...... cosas de tiranos.
>>>
>>>
>>> encima éste pendejo dice que lo admira.
>>
>
>