Remove clientscript block from page (ASP.NET 1.1)

Discussion in 'ASP .Net' started by =?Utf-8?B?bWFj?=, Jun 13, 2006.

  1. 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.
    =?Utf-8?B?bWFj?=, Jun 13, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?bWFj?=

    Poornimab Guest

    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.

    "mac" <> wrote in message
    news:...
    >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.
    >
    >
    Poornimab, Jun 20, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?bWFj?=

    Jacob Guest

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

    mac wrote:
    > 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.
    Jacob, Jun 20, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sck10
    Replies:
    7
    Views:
    7,430
    Steven Cheng[MSFT]
    Nov 17, 2005
  2. Nathan Sokalski
    Replies:
    4
    Views:
    60,995
    Alessandro Zifiglio
    Jul 3, 2006
  3. Dave Mathew
    Replies:
    2
    Views:
    6,286
    Clinton Farleigh
    Jul 20, 2006
  4. morrell
    Replies:
    1
    Views:
    933
    roy axenov
    Oct 10, 2006
  5. Nathan Sokalski

    ClientScript.RegisterClientScriptBlock in ASP.NET 2.0

    Nathan Sokalski, Jul 3, 2006, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    234
    Alessandro Zifiglio
    Jul 3, 2006
Loading...

Share This Page