NPersistence - .NET Persistence API

Step 8 - Edit the web form

You are here

  • Open the file 'Default.aspx’, this file was created automatically by 'Microsoft Visual Developer' when the web site was created.
  • To the tag ‘asp:content ID=”BodyContent”…’ add the following html tags:
<div>
        <h2>Add Employee</h2>
        <asp:Label ID="lblMessage" runat="server" /><br />
        <br />
        <table>
            <tr>
                <td>Employee ID:</td>
                <td>
                    <asp:TextBox ID="txtEmployeeID" runat="server" MaxLength="5" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate="txtEmployeeID" runat="server"
                        ErrorMessage="Employee ID must be provided" />
                </td>
            </tr>
            <tr>
                <td>First Name:</td>
                <td>
                    <asp:TextBox ID="txtFirstName" runat="server" MaxLength="40" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtFirstName" runat="server"
                        ErrorMessage="First name must be provided" />
                </td>
            </tr>
            <tr>
                <td>Last Name:</td>
                <td>
                    <asp:TextBox ID="txtLastName" runat="server" MaxLength="30" />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtLastName" runat="server"
                        ErrorMessage="Last name must be provided" />
                </td>
            </tr>
            <tr>
                <td align="center"><asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_OnClick" Text="Add Employee" /></td>
                <td><asp:Button ID="btnCancel" runat="server" OnClick="btnCancel_OnClick" Text="Cancel" CausesValidation="false" /></td>
            </tr>
        </table>
    </div>
    <div>
        <h2>Employees</h2>
        <br />
        <asp:GridView ID="grdEmployees" runat="server" AutoGenerateColumns="false">
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="Employee ID" />
                <asp:BoundField DataField="FirstName" HeaderText="First name" />
                <asp:BoundField DataField="LastName" HeaderText="Last name" />
            </Columns>
        </asp:GridView>
    </div>

Next: Step 9 - Edit the web form code