This example shows how to use the client-side API of Telerik DatePicker for ASP.NET MVC, Telerik TimePicker for ASP.NET MVC and Telerik DateTimePicker for ASP.NET MVC.
To use the client-side API you should first retrieve the datepicker client-side object.
The following code snippet shows how to do this:
<script type="text/javascript">
function getDatePicker(){
//"DatePicker" is the value specified by the Name() method.
var datePicker = $("#DatePicker").data("tDatePicker");
return datePicker;
}
</script>
Available client-side methods:
-
You can set selected date with the value(...) method. This method accepts Date object or string.
-
You can retrieve selected date with the value() method. This method returns Date object
or null.
-
You can show drop-down calendar in datepicker with the showPopup(...) method.
-
You can hide drop-down calendar in datepicker with the hidePopup(...) method.
-
You can use open(...) method to open timepicker's time view.
-
You can use close(...) method to close timepicker's time view.
-
You can open date view or time view drop-downs in datetimepicker with the open(...) method.
This method accepts "date" or "time" string.
-
You can close date view or time view drop-downs in datetimepicker with the close(...) method.
This method accepts "date" or "time" string.
-
You can enable datepicker with the enable() method.
-
You can disable datepicker with the disable() method.