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.
- <script type="text/javascript">
-
- $(document).ready(function() {
- $(".calendar-drop").datepicker({
- maxDate: "+0d",
- changeMonth: true,
- changeYear: true
- });
- </script>
An ASP.NET code is given below.
- <td class="td_label" style="text-align: right">From Date</td>
- <td class="td_form_input">
- <asp:TextBox ID="txtFromDate" runat="server" MaxLength="20" CssClass="calendar-text calendar-drop">08/22/2016</asp:TextBox>
- </td>
- <td class="td_label" style="text-align: right">To Date</td>
- <td class="td_form_input">
- <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.
- <link href="/Styles/jquery-ui-cal.css" rel="stylesheet" />
- <script src="/Scripts/jquery-1.12.4-cal.js" type="text/javascript"></script>
- <script src="/Scripts/jquery-ui-cal.js" type="text/javascript"></script>