Question might seem lengthy, but i have tried to cover all aspects.  

I am stuck on this issue for more than a couple of days and i don't know why but my DataAnnotations are not working on client side even though the code is generated for them and ModelState.isValid also returns false in Controller.  

I have added the following lines in my \_Layout file after searching on internet one by one.

```
@Html.ValidationSummary(true)
@{
   Html.EnableClientValidation();
   Html.EnableUnobtrusiveJavaScript();
}

```

And data annotations in Model are like:

```
public class PasswordChangeObject
{
    [Required(ErrorMessage = "Password is required")]
    //[StringLength(255, ErrorMessage = "Must be between 5 and 255 characters", MinimumLength = 5)]
    [DataType(DataType.Password)]
    public String oldPassword { get; set; }

    [Required(ErrorMessage = "New Password is required")]
    [StringLength(255, ErrorMessage = "Must be between 5 and 255 characters", MinimumLength = 5)]
    [DataType(DataType.Password)]
    public String newPassword { get; set; }

    [Required(ErrorMessage = "Confirming New Password is required")]
    [StringLength(255, ErrorMessage = "Must be between 5 and 255 characters", MinimumLength = 5)]
    [DataType(DataType.Password)]
    [Compare("newPassword", ErrorMessage="Passwords do not Match!")]
    public String confirmPassword { get; set; }
}

```

And in my cshtml file i have fileds like this:

```
@using (Html.BeginForm("ChangePassword", "ChangePass", FormMethod.Post, new { id = "chanegPassForm" }))
        {
            <div class="row">
                <div class="col-sm-4">
                    @*<input type="password" class="form-control" name="username" placeholder="Old Password" required>*@
                    @Html.TextBoxFor(vm => vm.oldPassword, new { @class = "form-control", @placeholder = "Old Password", @type = "password", @required = "true" })
                    @Html.ValidationMessageFor(vm => vm.oldPassword)
                </div>
            </div>
                <span class="help-block">Old Password</span>

                <div class="row">
                    <div class="col-sm-4">
                        @*<input type="password" class="form-control" name="username" placeholder="New Password" required>*@
                        @Html.TextBoxFor(vm => vm.newPassword, new { @class = "form-control", @placeholder = "New Password", @type = "password", @required = "true" })
                        @Html.ValidationMessageFor(vm => vm.newPassword)
                    </div>
                </div>
                <span class="help-block">New Password</span>

                <div class="row">
                    <div class="col-sm-4">
                        @*<input type="password" class="form-control" name="username" placeholder="Re-Type New Password" required>*@
                        @Html.TextBoxFor(vm => vm.confirmPassword, new { @class = "form-control", @placeholder = "Re-Type New Password", @type = "password", @required = "true" })
                        @Html.ValidationMessageFor(vm => vm.confirmPassword)
                    </div>
                </div>
                <span class="help-block">Re-Type New Password</span>
                <button id="changePasswordSubmitbtn" class="btn btn-default btn-primary" style="padding-top: 5px;" type="submit">Change Password</button>

        }

```

And finally the Scripts are included too...

```
<script src="~/Scripts/jquery-2.1.4.min.js"></script>
<script src="~/Scripts/jquery-ui.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<script src="~/Scripts/Custom/headroom.min.js"></script>
<script src="~/Scripts/Custom/jQuery.headroom.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

```

And yes, Html is being generated like:

```
<form action="/User/ChangePass/ChangePassword" id="chanegPassForm" method="post">                <div class="row">
                <div class="col-sm-4">

                    <input class="form-control" data-val="true" data-val-required="Password is required" id="oldPassword" name="oldPassword" placeholder="Old Password" required="true" type="password" value="" />
                    <span class="field-validation-valid" data-valmsg-for="oldPassword" data-valmsg-replace="true"></span>
                </div>
            </div>
                <span class="help-block">Old Password</span>
                <div class="row">
                    <div class="col-sm-4">

                        <input class="form-control" data-val="true" data-val-length="Must be between 5 and 255 characters" data-val-length-max="255" data-val-length-min="5" data-val-required="New Password is required" id="newPassword" name="newPassword" placeholder="New Password" required="true" type="password" value="" />
                        <span class="field-validation-valid" data-valmsg-for="newPassword" data-valmsg-replace="true"></span>
                    </div>
                </div>
                <span class="help-block">New Password</span>
                <div class="row">
                    <div class="col-sm-4">

                        <input class="form-control" data-val="true" data-val-equalto="Passwords do not Match!" data-val-equalto-other="*.newPassword" data-val-length="Must be between 5 and 255 characters" data-val-length-max="255" data-val-length-min="5" data-val-required="Confirming New Password is required" id="confirmPassword" name="confirmPassword" placeholder="Re-Type New Password" required="true" type="password" value="" />
                        <span class="field-validation-valid" data-valmsg-for="confirmPassword" data-valmsg-replace="true"></span>
                    </div>
                </div>
                <span class="help-block">Re-Type New Password</span>
                <button id="changePasswordSubmitbtn" class="btn btn-default btn-primary" style="padding-top: 5px;" type="submit">Change Password</button>
</form>

```

Now, please help me out of this situation.
**EDIT**  

I forgot to tell that only required is working nothing else.