1.5. Insert Client Script into a Page
Note: You can now insert client script into your web page as naturally as writing your server-side code.
In ASP.NET 2.0, you can insert client-side script by using the ClientScript property of the Page class.
1.5.1. How do I do that?
1.5.2. What about...
...including a script file?
Instead of inserting strings of client-side script into your application, you might have a much more sophisticated client-side application that is saved in a separate file. In this case, it is more effective for you to include the file directly rather than insert the scripts line by line.
You can include this script in your page through the RegisterScriptInclude( ) method:
'--including script files Dim scriptURL As String = "./hello.js" Page.ClientScript.RegisterClientScriptInclude( _ Me.GetType, "MyKey", scriptURL)
The generated output looks like this:
1.5.3. Where can I learn more?
MSDN has a comprehensive article on injecting client-side script from an ASP.NET server control: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-injectclientsidesc.asp.