|
August 17, 2002 Consuming the IsPrime Web Service using Code Behind Tips: August 2002
Yehuda Shiran, Ph.D.
|
|
In Column
114 we showed you how to consume the IsPrime
Web service from an ASP.NET page. Now, let's split the presentation from the business
logic by putting the JScript .NET code in a separate Code Behind file. Here is
the code:
We use the same namespace (ASPPlus) and class (codeBehind) as in other pages, so be sure to re-compile your Code Behind before displaying the ASP.NET page. We define two properties and one function. The property resultControl is the Label where we display the result of the IsPrime check. The property first is the TextBox where we read the input number from.
The function
Again, the communication between the ASP.NET page and the Code Behind is through the
Notice that we make sure the compiler finds the primeProxy namespace in the sampleProxy.dll file, by specifying the /r: switch. The following Command Control window shows the code listing as well as the compiler response:
People who read this tip also read these tips: Look for similar tips by subject: |