Clarification/explanation of RegisterClientScriptInclude method

Posted by mpminnich on Stack Overflow See other posts from Stack Overflow or by mpminnich
Published on 2010-04-20T13:50:36Z Indexed on 2010/04/20 13:53 UTC
Read the original article Hit count: 184

Filed under:
|

I've been looking on the Internet for a fairly clear explanation of the different methods of registering javascript in an asp.net application. I think I have a basic understating of the difference between registerStartupScript and registerClientScriptBlock (the main difference being where in the form the script is inserted). I'm not sure I understand what the RegisterClientScriptInclude method does or when it is used. From what I can gather, it is used to register an external .js file. Does this then make any and all javascript functions in that file available to the aspx page it was registered on? For example, if it was registered in the onLoad event of a master page, would all pages using that master page be able to use the javascript functions in the .js file? What problems would arise when trying to use document.getElementById in this case, if any? Also, when it is necessary/advantageous to use multiple .js files and register them separately?

I appreciate any help you can give. If you know of any really good resources I can use to get a thorough understanding of this concept, I'd appreciate it!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript