在views中使用 @using (Html.BeginForm()) 来完成,其中放一个submit类型的提交按钮,如:
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>人员信息</legend>
@Html.HiddenFor(model => model.ID)
<div class="editor-label">
@Html.LabelFor(model => model.Code,"编号")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Code)
@Html.ValidationMessageFor(model => model.Code)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Name,"姓名")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.RoleName,"角色")
</div>
<div class="editor-field">
@Html.DropDownList("RoleName")
@Html.ValidationMessageFor(model => model.RoleName)
</div>
@Html.HiddenFor(model => model.Password)
<div class="editor-label">
@Html.LabelFor(model => model.Remark,"备注")
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Remark)
@Html.ValidationMessageFor(model => model.Remark)
</div>
<p>
<input type="submit" value="保存" />
</p>
</fieldset>
}