Step : 1
Step : 2 link needed fromValidation css and js file like as vedio.
<link href="~/Plug/bootstrapvalidator-master/dist/css/bootstrapValidator.css" rel="stylesheet" />
<script src="~/Plug/bootstrapvalidator-master/dist/js/bootstrapValidator.js"></script>
Step : 3 Create view like as vedio.
Index.cstml
<br />
<div class="container">
@using (Html.BeginForm("Index", "Home", new { returnUrl = Request.QueryString["ReturnUrl"] }, FormMethod.Post, new { id = "addUser" }))
{
<div class="form-group">
<label class="col-md-3">Username:</label>
<input class="form-control User" name="Username" placeholder="Enter Name" />
</div>
<div class="form-group">
<label class="col-md-3">Password:</label>
<input class="form-control pwd" name="Password" placeholder="Enter Password" />
</div>
<div class="button">
<button>Submit</button>
</div>
<div>
@Html.ValidationSummary(true)
</div>
}
</div>
Step:4 Now write jquery method for from Validation [show display error message] like as vedio
<script type="text/javascript">
$(document).ready(function () {
$('#addUser').bootstrapValidator({
fields: {
Username: {
selector: '.User',
message: 'name not valid',
validators: {
notEmpty: {
message:'Name can not empty'
},
stringLength: {
min: 6,
max: 12,
message:'Name will be 6 to 12 digite'
}
}
},
Password: {
selector: '.pwd',
message: 'Password not valid',
validators: {
notEmpty: {
message: 'Password can not empty'
},
stringLength: {
min: 6,
max: 12,
message: 'Password will be 6 to 12 digite'
}
}
}
}
})
})
</script>
Now run the project
Related articles
MVC 5 Master Details Using Jquery Ajax | Entity Framework
MVC 5 Master Details Using Jquery Ajax | Entity Framework
Crystal Report Demo | Source Code Link
Crystal Report Demo | Source Code Link
CRUD Operations In MVC Using Jquery Ajax | Part-2 Create PopUp Modal With Registration Form
CRUD Operations In MVC Using Jquery Ajax | Part-2 Create PopUp Modal With Registration Form
CRUD Operation In MVC Using Jquery Ajax | Part-1 Retrieve Database Data & Show In A View
CRUD Operation In MVC Using Jquery Ajax | Part-1 Retrieve Database Data & Show In A View
Dynamically Loading Content With Jquery Ajax | ASP.NET MVC
Dynamically Loading Content With Jquery Ajax | ASP.NET MVC
Autocomplete Textbox In MVC | With Database | Jquery Ajax ⋆⋆⋆
Autocomplete Textbox In MVC | With Database | Jquery Ajax ⋆⋆⋆
How To Check Username Already Exist In Database In Asp.Net MVC | Jquery,Ajax
How To Check Username Already Exist In Database In Asp.Net MVC | Jquery,Ajax
How To Create Cascading Dropdownlist In Asp.Net MVC | Using Jquery Ajax
How To Create Cascading Dropdownlist In Asp.Net MVC | Using Jquery Ajax
How to export database data in excel file using ASP.NET MVC
How to upload image in database and displaying it using ASP.NET MVC | jquery Ajax
How to upload image in database and displaying it using ASP.NET MVC | jquery Ajax