August 13, 2002 - Writing Pages without Code Behind
August 13, 2002 Writing Pages without Code Behind Tips: August 2002
Yehuda Shiran, Ph.D.
|
<%@ Page LANGUAGE="JScript" %>
<HTML>
<HEAD>
<TITLE>Hello World Test</TITLE>
<SCRIPT LANGUAGE="JScript" RUNAT="server">
public function Page_Load(sender:Object, E:System.EventArgs) : void {
message.Text = "Hello World, Code Behind";
}
</SCRIPT>
</HEAD>
<BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
<FORM RUNAT="server">
<P ALIGN="center"><ASP:LABEL ID="message" RUNAT="server"></ASP:LABEL></P>
</FORM>
</BODY>
</HTML>
As you can see, the principles are the same. The Page_Load()
function is invoked automatically when the page loads. It sets the Text
property of the message
ID
to "Hello World, Code Behind"
. This ASP.NET file is self-sufficient, and you don't need to import any classes.To learn more about JScript .NET and ASP.NET, go to Column 115, JScript .NET, Part IX: Code Behind.