Last active
December 27, 2016 17:39
-
-
Save AbubakarSiddiq/879b46eb0c6e4712543595075c1bff17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@model ValidationDemo.Models.Student | |
@{ | |
ViewBag.Title = "Index"; | |
} | |
<h2>ASP.NET MVC DataAnnotations Validation</h2> | |
@using (Html.BeginForm()) | |
{ | |
@Html.AntiForgeryToken() | |
<div class="form-horizontal"> | |
<h4>Student</h4> | |
<hr /> | |
@Html.ValidationSummary(true, "", new { @class = "text-danger" }) | |
<div class="form-group"> | |
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.DateOfBirth, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.DateOfBirth, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.DateOfBirth, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.ConfirmEmail, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.ConfirmEmail, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.ConfirmEmail, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.ContactNo, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.ContactNo, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.ContactNo, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.Address, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.Address, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.Address, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.UserName, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.UserName, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.UserName, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
@Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" }) | |
</div> | |
</div> | |
<div class="form-group"> | |
<div class="col-md-offset-2 col-md-10"> | |
<input type="submit" value="Create" class="btn btn-default" /> | |
</div> | |
</div> | |
</div> | |
} | |
<div> | |
@Html.ActionLink("Back to List", "Index") | |
</div> | |
@section Scripts { | |
@Scripts.Render("~/bundles/jqueryval") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment