.NET     Console.WriteLine( "All Things .NET" );
.NET Nerd Blog Home
8.02.2005

 
ASP.NET
This article discusses some of the techniques for using JavaScript along with ASP.NET pages.

Some highlights:

<body id="Body1" runat="server">
Body1.Attributes["onload"] = "document.forms[0]['TextBox2'].focus();";

RegisterStartupScript (gets injected at the end of the server FORM element)

RegisterClientScriptBlock (gets injected at the top of the server FORM element, useful for scripts that need to be loaded before page elements are loaded)

Page.RegisterClientScriptBlock("MyScript", "<script language=javascript src='MyJavaScriptFile.js'>");



Here is a similar article with a little bit more depth from the 4GuysFromRolla dudes.


Comments: Post a Comment

Powered by Blogger