Reputation: 863
in my model i have email, password,new password and re-type new password property's are there.
[Required]
[DataType(DataType.EmailAddress)]
[Display(Name = "Email: ")]
public string Email { get; set; }
public bool changePassword { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Old Password:*")]
public string OldPassword { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "New Password:*")]
public string NewPassword { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Re-type Password:*")]
i put required to all controls. in my view i devide those controls like, Email in one form and remaining are another form. my problem is email validation is working in form form.
coming to another form validation is not working.
can any one suggest me to come out this problem.
Upvotes: 1
Views: 2031
Reputation: 1289
in your cshtml file say layout try putting this
@Scripts.Render("~/Scripts/jquery.validate.min.js")
@Scripts.Render("~/Scripts/jquery.validate.unobtrusive.min.js")
this might work.
Upvotes: 1
Reputation: 20421
Make sure that you are submitting to proper controller and using the ModelState.IsValid
// POST: /Orders/Create
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(Orders order) {
if (ModelState.IsValid) {
try {
.....
Upvotes: 1