- In your .aspx file add a script manager control with a reference to your javascript file: <asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="MyJavaScriptFile.js" />
</Scripts>
</asp:ScriptManager>
If you are using master pages in ASP.NET 2.0, please review:
I am utilizing master pages in my ASP.NET AJAX enabled web site. How do I load my custom JavaScript files when needed.
- ASP.NET AJAX ensures that all external JavaScript files have been properly loaded. In order to let ASP.NET AJAX know that the Javascript file has been loaded, the following code must be placed at the end of every .js file: if (typeof(Sys) != "undefined") {
Sys.Application.notifyScriptLoaded();
}