Watch this example on YouTube
@model WebApplication10.Models.Customer
@{ Html.EnableClientValidation();}
@using(Html.BeginForm(null, null, FormMethod.Post))
{
@Html.AntiForgeryToken();
@Html.CheckBoxFor(x => x.IsActive)
@Html.TextBoxFor(x => x.FirstName)
@Html.ValidationMessageFor(x => x.FirstName)
@Html.TextBoxFor(x => x.LastName)
<input type="submit" value="SUBMIT" />
}
@section Scripts{
<script type="text/javascript">
$("#IsActive").change(function (evt) {
var validator = $("#FirstName").validate();
var IsValid = $("#FirstName").valid();
});
</script>
}
No comments:
Post a Comment