LinkButton click, refresh the page

  • Thread starter Thread starter Sameer
  • Start date Start date
S

Sameer

I have a webpage that has a link button. This link button on click
opens up a new page.
This is what is happening:

1. Load the web page.
2. Click on the link.
3. Refresh the web-page.
Result: The webpage gets refreshed and the link buttons onClick event
is fired.

However, if I just load the web-page and without clicking on the link
button, refresh the web-page it does not fire the onClick event of the
link button.

I don't want the link button's onClick event to fire when I refresh the
web-page. How can we prevent this from happening?

Thanks and Regards,
Sameer
 
By clicking the link you are posting back the page. Once you've posted back
the page and the user hits refresh or F5 you're asking the browser to do
whatever it did last (which is a post). To fix this, have your LinkButton's
OnClick do a Response.Redirect(Request.Path).

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
The link button's onClick event does a window.open (Javascript) and
writes it to the response object. If I do a Response.Redirect, the
window.open action is lost.

Seems like I need some other way of doing the window.open and not using
the Response.Write to write the window.open javascript to it. Not
really sure how to do it...

Thanks,
Sameer
 
Back
Top