Chapter 9: Creating Web Applications with ASP.NET MVC | 277 |
The Add View screen in Figure
Listing 9-10 View for creating a new Customer
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MyShopCS.Customer>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Create </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Create</h2>
<% using (Html.BeginForm()) {%>
<fieldset>
<legend>Fields</legend>
<div
<%= Html.LabelFor(model => model.CustomerID) %> </div>
<div
<%= Html.TextBoxFor(model => model.CustomerID) %> <%= Html.ValidationMessageFor(
model => model.CustomerID) %>
</div>
<div
<%= Html.LabelFor(model => model.Name) %> </div>
<div
<%= Html.TextBoxFor(model => model.Name) %> <%= Html.ValidationMessageFor(
model => model.Name) %>
</div>
<div
<%= Html.LabelFor(model => model.Age) %> </div>