///////////////////Add Namespace-
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
public class Login
{
[Required]
public string UserID {
get; set; }
[Required]
public string Password
{ get; set; }
}
//////////////////// web.config file configuration
<appSettings>
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
//////////////////// Add J-query Libraries Inside script folder
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
//////////////////// Call J-query Libraries on page .cshtml
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
//////////////////// Call J-query Libraries page on top of the page
@{
Layout = null;
Html.EnableClientValidation(true);
}
No comments:
Post a Comment