0

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 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.