RadControls for ASP.NET AJAX The OnPopupOpening client-side event handler is called immediately before a popup calendar or time view is initialized to the current selection in the input area and then displayed.
Note |
|---|
The OnPopupOpening event is supported by: RadDatePicker, RadTimePicker, and RadDateTimePicker. |
Two parameters are passed to the event handler:
The following example uses the OnPopupOpening event to initialize the selection if the input area is empty:
CopyASPX
<script type="text/javascript">
function InitializePopup(sender, eventArgs) {
if (sender.isEmpty()) {
eventArgs.set_cancelCalendarSynchronization(true);
var popup = eventArgs.get_popupControl();
if (popup == sender.get_calendar()) {
if (popup.get_selectedDates().length == 0) {
var todaysDate = new Date();
var todayTriplet = [todaysDate.getFullYear(), todaysDate.getMonth() + 1, todaysDate.getDate()];
popup.selectDate(todayTriplet, true);
}
}
else {
var time = popup.getTime();
if (!time) {
time = new Date();
time.setHours(12);
popup.setTime(time);
}
}
}
}
</script>
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server">
<Calendar DayNameFormat="FirstLetter"
UseColumnHeadersAsSelectors="False"
UseRowHeadersAsSelectors="False">
</Calendar>
<ClientEvents OnPopupOpening="InitializePopup" />
</telerik:RadDateTimePicker>
See Also