I am trying to validate datepicker as startDate should be always less than EndDate. If I change the date manually then StartDate works but EndDate does not work.
My JavaScript Code:
$(document).ready(function () {
$("#StartDate").datepicker({
numberOfMonths: 1,
onSelect: function (selected) {
$("#EndDate").datepicker("option", "minDate", selected)
}
});
$("#EndDate").datepicker({
numberOfMonths: 1,
onSelect: function (selected) {
$("#StartDate").datepicker("option", "maxDate", selected)
}
});
});
My .cshtml code
<div class="col-sm-6">
<div class="form-group">
@Html.LabelFor(m => m.StartDate)
@Html.TextBoxFor(m => m.StartDate, new { @class = "form-control", placeholder = "Enter start date" })
@Html.ValidationMessageFor(m => m.StartDate, "", new { @class = "error" })
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
@Html.LabelFor(m => m.EndDate)
@Html.TextBoxFor(m => m.EndDate, new { @class = "form-control", placeholder = "Enter finish date" })
@Html.ValidationMessageFor(m => m.EndDate, "", new { @class = "error" })
</div>
</div>
Anyone please help me. Thank you in advance!

EndDatemanually. First please change start date manually by writing any date like01/16/2010before current date and it is taking the advantage of calendar to show that particular date inStartDatefield but the same calendar is not working forEndDatewhen we change from current date to any date greater than the date provided like01/22/2016. Please guide me.EndDatemanually, it is not taking an advantage of calendar.