Remove clientscript block from page (ASP.NET 1.1)

G

Guest

I have a requirement to open a popup window in button click event(after
server processing). The way i use is i call Page.RegisterClientScriptBlock to
register script for opening popup in the button click event and it works
fine. The only problem is when user refreshes the page, the popup opens
because the script is already there in the page and i want to avoid it. Is
there any way to open a popup without registering the script or is there a
way to remove the script.
 
P

Poornimab

Hi,
Use the following code. In Page _Load function , write these code
Page.RegisterClientScriptBlock("script","<script src='Popup.js'></script>");

Button1.Attributes.Add("onclick","showme()");

If u Click the button only, popup will open .Otherwise not.

Thanx.
 
J

Jacob

You could obviously only register the script if the page is not a
postback, other options are a cookies to remember if the popup has been
shown or simply a JavaScript boolean value to check if the script has
been run (but this will of course reset on a refresh).
 

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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top