O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Purchase Page

Clicking on the Purchase button on the Cart page brings you to the Purchase page. This page is used to gather billing and shipping information from the customer. It has a layout table with a bunch of TextBox controls, a couple of RadioButtonLists, a Buy Now button, and a bunch of associated validation controls.

The first row of the layout table is just a heading. The second row collects the Name. This is a required field, so it has a RequiredFieldValidator.

	<table border="0" class="TableRowHeading">
	    <tr>
	        <td colspan="4">
	            Billing Information
	        </td>
	    </tr>
	    <tr>
	        <td>Name</td>
	        <td colspan="4">
	            <asp:TextBox ID="txtName" runat="server" Width="250" />
	            <asp:RequiredFieldValidator ID="rfName" runat="server"
	                ControlToValidate="txtName"
	                Display="Dynamic" ErrorMessage="Name is a required field."
	                CssClass="ValidationError">*</asp:RequiredFieldValidator></td>
	    </tr>
Here's what the cart page looks like after you've added some items to the cart.

Figure 10-11. Here's what the cart page looks like after you've added some items to the cart.

All the validation controls on this page will use Dynamic Display, so room will only be allocated on the page if it is necessary to display the validation text. For this and all the other validation controls, the validation text is simply an asterisk to display next to the invalid control. A ValidationSummary control at the bottom of the page will gather all the ErrorMessages into a single location.

The next row is the Address, which ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required