LinkButton click, refresh the page

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
 
B

Brock Allen

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).
 
S

Sameer

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
 

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,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top