July 27, 2002 - Writing an ASP.NET Page | WebReference

July 27, 2002 - Writing an ASP.NET Page

Yehuda Shiran July 27, 2002
Writing an ASP.NET Page
Tips: July 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

An ASP.NET page is similar to an HTML page. It includes tags and event handlers. The tags' syntax is similar to that of HTML tags. You write event handlers in JScript .NET. Let's take the add Web service as an example. To call the add Web service, we use only two ASP.NET tags: ASP:BUTTON and ASP:TEXTBOX. All of ASP.NET's tag parameters are specified within the opening brackets, so you can end them with a "/" inside the opening brackets, or with a "/" concatenated with the tag name, in separate closing brackets. The following two formats are valid:

  <ASP:TEXTBOX ...... />
  <ASP:TEXTBOX ........></ASP:TEXTBOX>
ASP.NET pages are saved with the extension .aspx. Our ASP.NET page that consumes the add Web service is simpleCalcConsumer.aspx. Here is the BODY section of the ASP.NET page:

<BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
    <FORM METHOD="post" RUNAT="server">
    <TABLE BORDER="0">
    <TR><TD>Enter First Number:</TD><TD><ASP:TEXTBOX RUNAT="server" SIZE="4" 
      ID="first" STYLE="text-align:'right'"/></TD></TR>
    <TR><TD>Enter Second Number:</TD><TD><ASP:TEXTBOX RUNAT="server" SIZE="4"  
      ID="second" STYLE="text-align:'right'"/></TD></TR>
    <TR><TD align="right"><ASP:BUTTON TEXT="Add" ID="doAdd" OnClick="Submit_Click" 
      RUNAT="server"/></TD><TD><HR></TD></TR>
    <TR><TD></TD><TD><ASP:TEXTBOX ID="resultControl" RUNAT="server" 
      STYLE="text-align:'right'" SIZE="4"/></TD></TR>
    </TABLE>
    </FORM>
  </BODY>
To learn more about JScript .NET and ASP.NET, go to Column 113, JScript .NET, Part VII: Consuming add from ASP.NET.