Posts

Showing posts from October, 2017

How to add datepicker in asp.net MVC

<div class="editor-field">            @Html.LabelFor(model => model.DOB)  </div>  <div class="editor-field">             @Html.TextBoxFor(model => model.DOB, new {id = "date-picker",@onchange="getage(this.value);" })             @Html.ValidationMessageFor(model => model.DOB)   </div>  <p id="val"></p> <script type="text/javascript">     debugger     $(document).ready(function () {         debugger         // This will make every element with the class "date-picker" into a DatePicker element         $('#date-picker').datepicker();                   });     function getage(dob) {         debugger         var myyear = dob.substring(6, 10);         var mymonth = dob.substring(0, 2);         var myday = dob.substring(3, 5);                 today_date = new Date();         today_year = today_date.getFullYear();         today_month =