@model CardNumbers.Objects.Client @{ ViewBag.Title = "Edit"; } <h2>Edit Client @Model.Id</h2> @using (Html.BeginForm()) { @{Html.RenderPartial("_ClientForm", Model) ;} } <div> @Html.ActionLink("Back to List", "Index") </div> }and this is the _ClientForm.cshtml:
@using WebDemo.Helper @model CardNumbers.Objects.Client <fieldset> <legend>Client Info</legend> @Html.ValidationSummary(true) <input type="hidden" id="fntype" name="fntype"> @Html.HiddenFor(model => model.Id) @Html.EditorFor(model => model.Number, EditorTemplate.TextBox) @Html.EditorFor(model => model.Name, EditorTemplate.TextBox) @Html.EditorFor(model => model.Address, EditorTemplate.EditBox) <div id="ContactsInfo"> @*Contact 1*@ <div id="Contact1"> @Html.EditorFor(model=>model.Contact1) </div> @*Contact2*@ <div id="Contact2"> @Html.EditorFor(model => model.Contact2) </div> </div> @*<div class="clear"></div>*@ <div id="SaveCancel" class="float-right"> <button type="Submit" id="btnSave">Save</button> <button type="reset" id="btnCancel">Cancel</button> </div> </fieldset>