is there a way to find all script files added to a page in asp.net code behind? i am trying to add script dynamically but would like to check first if it already exist on the page.
2 Answers
AFAIK, no. Other developers can just add <script> tag on the fly and not through the .NET objects.
If you ensure that everyone uses ScriptManager, then you can use GetRegistered* methods on the object.
Comments
If it's inline script, you can use ClientScriptManager.RegisterClientScriptBlock which uniquely identifies a script by its type and key and will make sure it's registered only once.