In this article I will explain how to set months range or years range in JQuery calendar control in asp.net.
In previous post I explained show multiple months in calendar control and calendar control with dropdownlist selection for month and year. Now I will explain how to set months and years range in jquery calendar control.
To implement this one first open Visual Studio and create new website after that write following code in your aspx page
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Default functionality</title>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.19.custom.css"
rel="stylesheet"
/>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
<script type = "text/javascript">
$(function()
{
$("#txtMonthRange").datepicker({
minDate: 0,
maxDate: '+1M',
showButtonPanel: true
});
$("#txtYearRange").datepicker({
changeMonth: true,
changeYear:true,
yearRange:'1970:2010'
})
});
</script>
<style type="text/css">
.ui-datepicker { font-size:8pt !important}
</style>
</head>
<body>
<form id="form1"
runat="server">
<div class="demo">
<b>Month Range:</b> <asp:TextBox ID="txtMonthRange"
runat="server"/>
<b>Year Range:</b><asp:TextBox ID="txtYearRange" runat="server"/>
</div>
</form>
</body>
</html>
|
$("#txtMonthRange").datepicker({
minDate: 0,
maxDate: '+1M',
showButtonPanel: true
});
|
$("#txtYearRange").datepicker({
changeMonth: true,
changeYear:true,
yearRange:'1970:2010'
})
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
|


Subscribe by RSS
Subscribe by Email
2 comments :
Hey
Can you tell me ,after setting the year range, How to set a particular year in the Year_DropDownList. Like if i set yearRange :'1950:1994' , there i want 1994 to be selected ?.
Thanks