spacer
Yehuda Shiran August 18, 2002
Linking Code Behind to the IsPrime Web Service Consumer
Tips: August 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

We showed you in Column 114 how to consume the IsPrime Web service from an ASP.NET page. Let's now split the presentation from the business logic by putting the JScript .NET code in a separate Code Behind file. Here is the page for consuming the IsPrime Web service, IsPrimeConsumerForm.aspx:

  <%@ Page LANGUAGE="JScript" SRC="IsPrimeConsumerForm.aspx.js" 
    INHERITS="ASPPlus.codeBehind" %>
  <HTML>
  <HEAD>
    <TITLE>IsPrime XML Web Service Test</TITLE>
  </HEAD>
  <BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
    <FORM RUNAT="server">
      <TABLE BORDER="0">
        <TR>
          <TD ALIGN="middle"><ASP:TEXTBOX ID="first" RUNAT="server" SIZE="4" 
            STYLE="text-align:'right'"/></TD>
          <TD ALIGN="middle"><ASP:LABEL ID="resultControl" RUNAT="server"/></TD>
        </TR>
        <TR>
          <TD><ASP:BUTTON TEXT="Is Prime?" ID="isprime" OnClick="Submit_Click" 
            RUNAT="server"/></TD>
        </TR>
      </TABLE>
    </FORM>
  </BODY>
  </HTML>
We have three controls. The first ASP:TextBox control serves for inputting the number to be tested. We use the resultControl ASP:Label to display the result of the check, "is not a prime number" or "is a prime number". The last control is the isprime ASP:Button. When clicked, the function Submit_Click() is called from the Code Behind.

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:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger