【发布时间】:2014-04-07 15:36:34
【问题描述】:
在 bootstrap 3 中,我们可以将 Validation States 添加到我们的文本框中。
但是如果我必须在我的 MVC5 应用程序中实现并在用户键入时更改文本框的验证状态。我该怎么做? 例如:
在我的模型中如果我有一些字段
[Required(ErrorMessageResourceType = typeof (Resource), ErrorMessageResourceName = "RegisterViewModel_FirstName_First_Name_is_required")]
在视野中
@Html.TextBoxFor(m=>m.Name)//change textbox according to state using Bootstrap 3 validation state?
@Html.ValidationMessageFor(m=>m.Name)
在网站中,他们只给出类名:
<div class="form-group has-success">
<label class="control-label" for="inputSuccess1">Input with success</label>
<input type="text" class="form-control" id="inputSuccess1">
</div>
<div class="form-group has-warning">
<label class="control-label" for="inputWarning1">Input with warning</label>
<input type="text" class="form-control" id="inputWarning1">
</div>
<div class="form-group has-error">
<label class="control-label" for="inputError1">Input with error</label>
<input type="text" class="form-control" id="inputError1">
</div>
有人在他们的应用程序中实现了这一点吗?
知道如何在 MVC 应用程序中实现这一点真是太棒了。
我不知道如何实现。
【问题讨论】:
-
如果您有解决方案,请与我们分享,我也一样
标签: jquery html css asp.net-mvc twitter-bootstrap-3