Your First Web Forms Application

Because this is a kick start book, let's get started in actually using the product. Of course, being a technology, Hello World is required. So let's see how a simple Hello World application works in ASP.NET (see Listing 8.1).

Listing 8.1. Say Hello to ASP.NET
<%@ Page Language="C#" %>
<script runat="server">
    void submitButton_Click(object sender, EventArgs e) {
        message.Text = "Hello "+name.Text;
    }

    void clearButton_Click(object sender, EventArgs e) {
        message.Text = "";
        name.Text = "";
    }
</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <table border="1">
            <tbody>
                <tr>
                    <td>
                        Name</td>
                    <td>
                        <asp:TextBox id="name" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td> Message</td> <td> <asp:Label id="message" ...

Get Microsoft® .NET Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.