RegisterClientScript from a User COntrol

Discussion in 'ASP .Net Web Controls' started by Jawahar, Aug 19, 2005.

  1. Jawahar

    Jawahar Guest

    All
    We have an in-house web application that uses several User controls on a
    single web page!
    So each time the page loads the Page_load events of all the user cotrols
    also fire.
    One of the controls uses RegisterClientScript in its page_Load event. This
    is fine when the control is visible but not otherwise. we often get
    Javascript errors from script functins that are trying to refer to the user
    control when it is no longer visible. The script the User control emmited is
    still there on the main page.

    Is there a way of unregistering the script block?
    I.E. the oppisite of RegisterClientScript. I have tried to use the
    IsClientScriptRegitered but this is not working as I expect. Is this because
    I am using a user control rather than a regular Web Page?

    Any help is appreciated

    Jawahar Rajan
    Jawahar, Aug 19, 2005
    #1
    1. Advertising

  2. Jawahar

    Marcel Guest

    Since RegisterClientScriptBlock is virtual you can overwrite it and
    store all key/script collections in your own
    dictionaryentry-collection.

    Add your own function to remove an script item for a given key.

    At the last momoment, register all script blocks using the base-class
    implementation of RegisterClientScriptBlock.

    Hope this is helpfull...

    Marcel van Eijkel
    ( www.vaneijkel.com )
    Marcel, Aug 22, 2005
    #2
    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. Boris Twila

    registerclientscript

    Boris Twila, Nov 1, 2006, in forum: ASP .Net
    Replies:
    11
    Views:
    585
    Laurent Bugnion
    Nov 3, 2006
  2. Fritz the Cat

    registerclientscript

    Fritz the Cat, Mar 29, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    298
    Mark Rae
    Mar 29, 2007
  3. DNB
    Replies:
    2
    Views:
    1,799
    Michael Nemtsev
    Dec 13, 2007
  4. Rain
    Replies:
    0
    Views:
    330
  5. collie

    RegisterClientScript

    collie, Dec 1, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    147
    Jim Cheshire [MSFT]
    Dec 1, 2003
Loading...

Share This Page