button_click fired by F5

G

gaddoznntp

Hi all,
I've a server button handling a button_click procedure.
If the client user clicks the button, the page causes the postback and
the
button_click procedure is fired.
Then, if the user press F5 (refresh page), the button_click procedure
is
fired again.
Someone knows how to workaround this problem, or where I'm going wrong?

Thank you in advance!
Regards

Gaddoz
 
G

gaddoznntp

I'm a little confused!
I need to call the procedure only when the user clicks the button,
not when refreshes the page, also if the user clicked the button one
time before...
 
M

MiniMe

I don't know if you can block it. You can try to block f5 key in javascript,
but I'm not sure about that.
 
G

gaddoznntp

I don't want block the refresh!
I need to fire some procedure only when the user clicks the button.
 
M

Mark Rae

I'm a little confused!
I need to call the procedure only when the user clicks the button,
not when refreshes the page, also if the user clicked the button one
time before...

What do you think the Refresh button does?

It instructs the webserver to re-execute the most recent page load in
exactly the same way as it was loaded the last time, so if the last load was
as a result of clicking a button, that's exactly what the Refresh button
will try to do...
 
G

gaddoznntp

I was thinking that refresh instructs the browser to recall the page!
And I was thinking that is the asp.NET statewiev to tell that there was
a button a click.
Isn't it??
 
L

Lau Lei Cheong

The workaround is to add a inputhidden field with javascript that'll clear
it onload. And then set it to some value before submit.

So on your codebehind, you can tell the difference. :)
 
L

Lau Lei Cheong

Sorry, it won't work. I've get the idea wrong. The postback inited this way
seems to neglect the current input field values... :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top