将日期时间控制集中在验证上的MVC验证失败

时间:2016-10-11 11:07:37

标签: validation asp.net-mvc-4

我的观点如下

@using (Html.BeginForm("Apply", "Leave", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="row">
    <div class="col-xs-12 col-sm-6 col-md-6">
    <div class="form-group">
       Leave Type
     @Html.DropDownListFor(m => m.LeaveTypeId, Model.LeaveType, "Choose...", new { @class = "form-control", @tabindex = "1" })
     @Html.ValidationMessageFor(m => m.LeaveTypeId, "", new { @class = "label-danger" })
    </div>
    </div>
    </div>
    <div class="row">
    <div class="col-xs-12 col-sm-6 col-md-6">
    <div class="form-group">
      From Date
     @Html.TextBoxFor(m => m.FromDate, new { @class = "form-control", @tabindex = "2" })
      @Html.ValidationMessageFor(m => m.FromDate, "", new { @class = "label-danger" })
   </div>
   </div>
}

enter image description here

当我点击“应用”按钮时,它会自动聚焦下一个控件,因为我的标签索引已设置。那么有没有办法聚焦但不显示日期时间控件

0 个答案:

没有答案