TimePicker - Client-Side API

Event log

Demo Configurator

  • /MinDate (Time)
  • /MaxDate (Time)
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadTimePicker exposes rich client-side API set which allows easy and flexible use in a wide range of application scenarios. In this example we demonstrate the main client-side functions:

TimePicker

  • showTimePopup
  • hideTimePopup
  • get_timeView()

  • set_enabled()
  • set_minDate()
  • set_maxDate()

TimeView

  • setTime
  • getTime
  • get_oldTime
  • get_newTime
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
<%@ Page Language="c#" CodeFile="DefaultCS.aspx.cs" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Calendar.DateTimePicker.ClientAPI.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <script type="text/javascript" src="scripts.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function pageLoad() {
                demo.initialize($find("<%= RadTimePicker1.ClientID %>"));
            }
        </script>
    </telerik:RadCodeBlock>
    <div class="demo-container size-thin" runat="server" id="containerDiv">
        <h3>RadTimePicker</h3>
        <telerik:RadTimePicker RenderMode="Lightweight" ID="RadTimePicker1" Width="100%" runat="server">
            <TimeView ID="TimeView1" runat="server" OnClientTimeSelected="ClientTimeSelected">
            </TimeView>
        </telerik:RadTimePicker>
    </div>
    <qsf:EventLogConsole runat="server" ID="EventLogConsole1"></qsf:EventLogConsole>

    <qsf:ConfiguratorPanel ID="ConfigurationPanel1" runat="server" Title="Demo Configurator" Orientation="Vertical"
        Expanded="true">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn2" runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <span class="checkbox">
                                <asp:CheckBox runat="server" ID="MinDate" Text="05:00 AM" onclick="setMinDate(this);"></asp:CheckBox> /MinDate (Time)</span>
                        </li>
                        <li>
                            <span class="checkbox">
                                <asp:CheckBox runat="server" ID="MaxDate" Text="08:00 PM" onclick="setMaxDate(this);"></asp:CheckBox> /MaxDate (Time)</span>
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn1" runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <qsf:Button ID="Button1" runat="server" Text="Move to next hour" Size="Auto" OnClientClicked="NextTime" AutoPostBack="false"></qsf:Button>
                        </li>
                        <li>
                            <qsf:Button ID="Button2" Text=" Clear DatePicker value" runat="server" Size="Auto" OnClientClicked="clearText" AutoPostBack="false"></qsf:Button>
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?