RadCalendar for ASP.NET AJAX

RadControls for ASP.NET AJAX

It is sometimes necessary for a TimeView selection to be canceled. This may be the case when we have disabled a particular TimeView cell. An example of this is when the user should be able to select given time intervals, but not other.

Note

The OnClientTimeSelecting event is supported by: RadTimeView.

In this case, one can use the OnClientTimeSelecting client side event handler, which is cancelable. One usage is demonstrated by the code sample below:

CopyASPX
     

<telerik:RadTimePicker runat="server" Id="Picker1">
    <TimeView runat="server" ID="TimeView1" OnClientTimeSelecting="ClientTimeSelecting">
    </TimeView>
</telerik:RadTimePicker>
CopyXML
 <script type="text/javascript">
     function ClientTimeSelecting(sender, eventArgs) {
         eventArgs.set_cancel(true);
     }
</script>

Two parameters are passed to the event handler:

  • sender is the time view control.

  • eventArgs has the following properties:

    • get_oldTime() returns the time before the user selected a new time value.

    • get_newTime() returns the newly selected time value.

    • set_cancel(true/false) a method which determines whether the event should be canceled (true), or allowed to proceed normally (false).