jQuery Calendar Lightweight Changeable Year And Month, Calendar Validation Up To the Current Date

Select a date from a textbox calendar in an ASP.NET.
  • It is refered from jQuery site.
  • Here, calendar year and months are changeable.
  • Year and month in dropdown are required to be selected.
  • Calendar validation up to the current date.
  • Flexible in all the Browsers.
  • Multiple text boxes have common code for the calendar.
  • For reference, attach jQuery files.


jQuery code is given below.
  1. <script type="text/javascript">  
  2.     //// calendar code  
  3.     $(document).ready(function() {  
  4.                 $(".calendar-drop").datepicker({  
  5.                     maxDate: "+0d",  
  6.                     changeMonth: true,  
  7.                     changeYear: true  
  8.                 });  
  9. </script>  
An ASP.NET code is given below.
  1. <td class="td_label" style="text-align: right">From Date</td>  
  2. <td class="td_form_input">  
  3.     <asp:TextBox ID="txtFromDate" runat="server" MaxLength="20" CssClass="calendar-text calendar-drop">08/22/2016</asp:TextBox>  
  4. </td>  
  5. <td class="td_label" style="text-align: right">To Date</td>  
  6. <td class="td_form_input">  
  7.     <asp:TextBox ID="txtToDate" runat="server" MaxLength="20" CssClass="calendar-text calendar-drop">01/01/2017</asp:TextBox>  
File reference in an ASP.NET code is given below. 
  1. <link href="/Styles/jquery-ui-cal.css" rel="stylesheet" />  
  2. <script src="/Scripts/jquery-1.12.4-cal.js" type="text/javascript"></script>  
  3. <script src="/Scripts/jquery-ui-cal.js" type="text/javascript"></script> 
Next Recommended Reading Fluent Validation And Its Advantages