2

I'm using one JavaScript binds in Master Page for the entire project, and the Master Page doesn't include a ScriptManager, that is, some pages include Ajax components, like UpdatePanel, but some not. The 'Sys.WebForms..' functions set in the 'Global' JavaScript works fine with the page has a ScriptManager, but it will cause JS errors in non-ajax page, e.g. 'Sys is undefined, $find is undefined.'

The message is very annoying, though the it doesn't effect anything.

So any smart solutions?

Is adding ScriptManager to Master Page the best solution? (but need to remove all the ScriptManager in child pages).

Regards

2 Answers 2

1

an if statement saves the day :)

if ( Sys != null || Sys !='undefined')
 Sys.WebForms...
Sign up to request clarification or add additional context in comments.

Comments

1

If you're going to reference Sys in your global Javascript libraries, then put the ScriptManager on the master page and remove it from the child pages.

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.