|
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ModelBinding1.Models.Employee>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
ViewPage1
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Employee Model Binding 1</h2>
<% using (Html.BeginForm("Update","Employee")) {%>
<%= Html.ValidationSummary(true) %>
<fieldset>
<legend>Fields</legend>
<div class="editor-label">
<%= Html.LabelFor(model => model.EmpId) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.EmpId) %>
<%= Html.ValidationMessageFor(model => model.EmpId) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.EmpName) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.EmpName) %>
<%= Html.ValidationMessageFor(model => model.EmpName) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.EmpDesignation) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.EmpDesignation) %>
<%= Html.ValidationMessageFor(model => model.EmpDesignation) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.EmpDepartment) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.EmpDepartment) %>
<%= Html.ValidationMessageFor(model => model.EmpDepartment) %>
</div>
<div class="editor-label">
<%= Html.LabelFor(model => model.EmpSalary) %>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => model.EmpSalary) %>
<%= Html.ValidationMessageFor(model => model.EmpSalary) %>
</div>
<p>
<input type="submit" value="Save" />
<%= Html.ActionLink("Using Query Strings", "UpdateQueryString", new { EmpId = 1, EmpName = "Nick", EmpDepartment = "IT", EmpDesignation = "Director" })%>
<%= Html.ActionLink("Controlling Model Binding", "BindInclude", new { EmpId = 1, EmpName = "Nick", EmpDepartment = "IT", EmpDesignation = "Director" })%>
</p>
</fieldset>
<% } %>
<div>
<%= Html.ActionLink("Next", "EmployeeView2")%>
</div>
</asp:Content>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have around 9 years of experience in Microsoft technologies, .Net 2.0,3.5, Asp.net MVC developed small to medium scale products using Silverlight 2.0, Asp.net Ajax technologie and Javascript frameworks.