This is a migrated thread and some comments may be shown as answers.

Check if script is registered in manager

1 Answer 242 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Remi
Top achievements
Rank 2
Remi asked on 06 Nov 2009, 08:58 PM
Hello,

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.

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 11 Nov 2009, 04:16 PM
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.

Greetings,
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.
Tags
ScriptManager and StyleSheetManager
Asked by
Remi
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Share this question
or