Set startTime of TimePickerControl in Grid from clientside

3 posts, 0 answers
  1. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 24 Jun 2010 Link to this post

    I have a RadGridView. In the edit form template i have 2 RadTimePciker Control. So using add new command i can get the edit template for enter 2 times.

    My requirement is when i select one time in first time picker i need to change the startTime of the second time picker to the next interval. SO i can avoid one validation.
    For eg:
     If i select 7:30 in the first time pciker and the time interval is 15 minutes the second time picker's start time is 7:45 only

    Any possibility to do in the client side. I saw one evet called onclientTimeSelected But not get any set_StartTime or something like that to set a new start date and also how to get the object in the edit form template in clientside
  2. Martin
    Martin avatar
    823 posts

    Posted 29 Jun 2010 Link to this post

    Hello Akhil Raj,

    To get a reference to the second picker from the DateSelected client-side event handler you can use this approach:

        <telerik:RadTimePicker runat="server" ID="RadTimePicker1">
            <ClientEvents OnDateSelected="DateSelected" />
        <br />
        <telerik:RadTimePicker runat="server" ID="RadTimePicker2">
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                function DateSelected(sender, args)
                    var picker2 = $find('<%# ((GridItem)Container).FindControl("RadTimePicker2").ClientID %>');

    However to set the start time of the second picker you should wire the SelectedDateChanged event of the first RadTimePicker:

    protected void RadTimePicker1_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
        RadTimePicker picker1 = sender as RadTimePicker;
        RadTimePicker picker2 = picker1.NamingContainer.FindControl("MySecondPicker") as RadTimePicker;
        picker2.TimeView.StartTime = picker1.SelectedDate.Value.TimeOfDay;

    I hope this helps.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 30 Jun 2010 Link to this post

    k thanks friend. i just used validation instead of this. but your help is really appreacited...
Back to Top