When should I use ScriptManager to register scripts and when is it ok to use the Page.ClientScript? What are the rules?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The intention is for ScriptManager to be used with ASP.NET AJAX-specific scripts, since it is supposed to ensure things are placed in the right order with the right dependencies pre-registered for ASP.NET AJAX controls and scripts to work properly.
The ClientScriptManager (Page.ClientScript) is for JavaScripts in general, e.g. anything that is not directly tied to ASP.NET AJAX.
(Per MSDN: http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.aspx, http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.aspx)