我有这样的问题,在我的页面中我有两个表单,每个表单标记代表控制器中的不同操作。我想要做的是我想对每个表单进行单独的验证。
<form class="form-horizontal" action="@Url.Action("Index")" method="POST">
<div class="row">
<div class="span5">
<div class="control-group">
<label class="control-label">From</label>
<div class="controls">
@Html.EditorFor(m => m.FromDate, "Date")
<span class="add-on"><i class="icon-calendar"></i></span>
</div>
</div>
<div class="control-group">
<label class="control-label">To</label>
<div class="controls">
@Html.EditorFor(m => m.ToDate, "Date")
<span class="add-on"><i class="icon-calendar"></i></span>
</div>
</div>
</div>
<div class="span5">
<div class="control-group">
<label class="control-label" >Employee Group</label>
<div class="controls">
@Html.DropDownListFor(m => m.EmployeeGroupId, Model.EmployeeGroupList, "-- Select Employee Group --")
</div>
</div>
<div class="control-group">
<label class="control-label" for="Description">Employee(s) <span class="required"></span></label>
<div class="controls">
@Html.ListBoxFor(m => m.SelectedEmployeeList, Model.EmployeeList , new
{
@Id = "EmployeeInfo",
@class = "chzn-select",
data_placeholder = "Choose Employee(s) ...",
style = "width:350px;"
})
</div>
</div>
</div>
</div>
<div class="form-actions">
<button class="btn btn-info" type="submit"><i class="icon-ok"></i>Filter</button>
<button class="btn" type="reset"><i class="icon-undo"></i>Reset</button>
</div>
</form>
<form id="form-attendance-edit-list" class="form-horizontal" action="@Url.Action("UpdateAll")" method="POST">
@if (!ViewData.ModelState.IsValid)
{
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert"><i class="icon-remove"></i></button>
<strong><i class="icon-remove"></i>Oh Cemex!</strong>
<br>
@Html.ValidationSummary()
</div>
}
@Html.Partial("List", Model)
</form>
我想分别在页面中验证每个表单。目前它一次验证两个表单。我能实现这个吗?