spacer
Yehuda Shiran August 13, 2002
Writing Pages without Code Behind
Tips: August 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
HP to Microsoft: Thanks for Nothing
iPhone Remains Left Out as Android Scores Flash
The Year of Living the OpenSocial
Sometimes, using Code Behind is too complicated for a simple task. You can put your JScript .NET code in the ASP.NET page directly. Here is the Hello World application in one piece, for your reference:

  <%@ 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.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Gateway Launches New Core i7-powered FX-Series Gaming PCs · Review: Lenovo ThinkPad SL300 · EBay, Alternative Site Holiday Resources for Sellers