Friday, January 14, 2011

Jquery datepicker with blackout dates

// code for .aspx page


<html>
<head>
<title></title>
    <link href="css/datepicker.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<!-- required plugins -->
<script type="text/javascript" src="scripts/date.js"></script>
<!--[if IE]><script type="text/javascript" src="scripts/jquery.bgiframe.js"></script><![endif]-->

<!-- jquery.datePicker.js -->
    <script src="scripts/datepicker.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function () {
            $('.date-pick')
.datePicker(
{
   createButton: false,
   renderCallback: function ($td, thisDate, month, year) {
       if (thisDate.isWeekend()) {
           $td.addClass('weekend');
           $td.addClass('disabled');
       }
   }
}
)
.bind('click',
function () {
   $(this).dpDisplay();
   this.blur();
   return false;
}
)
.bind('dateSelected',
function (e, selectedDate, $td) {
   console.log('You selected ' + selectedDate);
}
);
        });
  
    </script>

</head>
<body>
Date<input type="text" name="datepicker"   id="datepicker" class="date-pick" />
</body>
</html>

// you can get files from Here click here for datapicker.js
click here for css file
click here for .date.js file