HTML and CSS Reference
Figure 2-1. Create an ASP Web Forms project
Using the Email Control
For the first exercise, you'll modify the registration form to require a valid email address be used as the user
name. You'll also use the placeholder attribute to let the users know that an email address is needed.
eXerCISe 2-1. MODIFYING the reGIStratION paGe
In the Chapter 2 project, open the Register.aspx page, which you'll find in the
There are several li elements in the fieldset node that define the input fields.
The first one is for the User Name. Change this as follows by entering the attributes
shown in bold:
<asp:Label runat="server" AssociatedControlID="UserName">User name</asp:Label>
<asp:TextBox runat="server" ID="UserName"
TextMode="Email" placeholder="use your email address" Width="200" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="UserName"
ErrorMessage="The user name field is required." />
Start the application by pressing F5. Using the Chrome browser, the Register page
will look like Figure 2-2 . Notice the text in the User name field.