In this post I will explain to have Jquery Date Picker for FromDate & ToDate with MinDate, MaxDate Validation.
Add two Textbox in your page.
From Date :
<asp:TextBox ID="txtFDate" runat="server" ClientIDMode="Static"></asp:TextBox>
To Date :
<asp:TextBox ID="txtTDate" runat="server" ClientIDMode="Static"></asp:TextBox>
then add the following script in your head part.
<script src="../Scripts/jquery.ui.datepicker.js" type="text/javascript"></script>
<link href="../Styles/jquery-1.9.1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
DatePick();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(DatePick);
});
function DatePick() {
$("#txtFDate").datepicker({
buttonImage: '',
buttonImageOnly: true,
changeMonth: true,
format: 'dd/MM/yyyy',
changeYear: true,
showOn: 'both',
onSelect: function (selectedDate) {
$("#txtTDate").datepicker("option", "minDate", selectedDate);
}
});
$("#txtTDate").datepicker({
buttonImage: '',
buttonImageOnly: true,
changeMonth: true,
format: 'dd/MM/yyyy',
changeYear: true,
showOn: 'both',
onSelect: function (selectedDate) {
$("#txtFDate").datepicker("option", "maxDate", selectedDate);
}
});
}
</script>
No comments:
Post a Comment