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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

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

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint