Sams Teach Yourself C in 21 Days

(singke) #1
The C# Programming Language 777

BD7


11: <asp:button runat=”server” text=”Say Hello”
12: onclick=”doClick” />
13: <p>
14: <asp:label runat=”server” text=”” id=”MyLabel” />
15: </form>
16: </body>
17: </html>

Figure B7.1 shows the hello.aspx program when the web page is first displayed.
When you click the button, you see the result shown in Figure B7.2.

LISTINGB7.4 continued

OUTPUT

FIGUREB7.1
The initial output
of the Hello.aspx
program.

FIGUREB7.2
The output after select-
ing the button and run-
ning the C# code.

This is a relatively short program with only a small amount of functionality. This
is also a Web program that requires a server that supports ASP.NET. This would
include Microsoft’s Internet Information Server.
When you first run this program, you get a Web page as shown in Figure B7.1. If you
look at the code in lines 6 to 17, you’ll see what looks like standard HTML to display a

ANALYSIS

42 448201x-Bonus7 8/13/02 11:24 AM Page 777

Free download pdf