Jquery Date-time Picker in asp.net pages

Before coading first of all you  have to download the plugin from here:- http://fgelinas.com/code/timepicker/.

follow the steps:-
1] Add reference of plugin into your asp page
2] Add the code in your javascript function like

      <script type="text/javascript"> 
           $(document).ready(function() 
{
  DatePicker();
});
      function DatePicker()
{
    var startDateTextBox = $('#<%= txtStartDate.ClientID%>');
    
    startDateTextBox.datetimepicker({
    minDate: 0,
    dateFormat: "dd/mm/yy",
    changeMonth: true,
    showAnim: 'slideDown',
    showOn: "focus",
    timeFormat: "hh:mm TT",
    numberOfMonths: 2,
    separator:' ',
onClose: function(dateText, inst) {
        if (endDateTextBox.val() != '') {
        var testStartDate = startDateTextBox.datetimepicker('getDate');
        var testEndDate = endDateTextBox.datetimepicker('getDate');
        if (testStartDate > testEndDate)
        endDateTextBox.datetimepicker('setDate', testStartDate);
         }
        else {
        
         }
               },
                    onSelect: function (selectedDateTime){
                   endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
                } 
            });

        </script>
Ebook Download
View all
Learn
View all