Check if script is registered in manager

2 posts, 0 answers
  1. Remi
    Remi avatar
    38 posts
    Member since:
    Oct 2007

    Posted 06 Nov 2009 Link to this post


    I have a situation where I'm registering scripts with the script manager. I'm wondering if there is a check to see if the script is already registered in the manager before adding it.

    I'm using a single page design model and what is happening is scripts are being added to the page more than once.

    I'm looking for a property of the script manager or ajax manager to be something like IsScriptSet or even some functionality to simple check to ensure scripts are already added and if so, don't add again, just ignore the registration with the script manager.

    The big issue, to clarify, is that my page is getting bloated with duplicate scripts being registered when users interact with my single page interface to my website.  Please Help me stop the bloat!! :) Getting away from the single page design is not an option, it's in stone at the moment, so we need a check.

    I appreciate any advice or feedback. Thanks very much.
  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 11 Nov 2009 Link to this post

    Hi Remi,

    The ScriptManager (and RadScriptManager) has a Scripts collection which contains the ScriptReferences of the current instance. In addition it exposes the following methods:
    GetRegisteredStartupScripts() and GetRegisteredClientScriptBlocks()

    I hope this is what you are looking for.

    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top