Problems during reload/refresh

  • Thread starter Thread starter Hans Meier
  • Start date Start date
H

Hans Meier

Hi,

i have done a shopcart application and I have the following problem:

The event "itemcommand" (Datalist.button) is fired every single time the
user reloads/refreshes the page (after he once pressed the right button).
Postback is always true (cause this error occurs only after the user once
pressed this button) so that´s not the way. Is there any other event raised
when a user reloads his page? Or how can I get rid of this? pls help

thx
Hans
 
I have to add that it seems that a pagereload by the user raises the
itemcommand again so there must be a chance to avoid this (I hope) :D

Hans
 
Hans,

I'm not certain if this proposed solution would work for you or not.

Here's what's happening: Every time you click an <asp:button you are posting
form data back to the server. When a user refreshes the page that form data
is posted to the form data is reposted. Thus every time a user refreshes the
page after the first post the button is pressed again because it's now part
of the form post.

You could get rid of this by doing a Response.Redirect back to the same page
after the intitial button click. But of course that will make it seem as if
the user is entering the page for the first time. So if the button click is
changing the page layout you could have a problem there.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
Back
Top