specify 2 columns in radtimepicker

4 posts, 0 answers
  1. Swadesh Brojolall
    Swadesh Brojolall avatar
    7 posts
    Member since:
    Apr 2010

    Posted 27 Apr 2010 Link to this post

    Hi;
    Please help on the issue below.
    How can I specify only 2 columns on the radtimepicker.

    That is when the timeview loads it is limited to 08:00 to 17:00, with 30 mins interval and there are only 2 columns. One having the hourly values and the other having the half hourly values e.g 08:00 on one side and 08:30 on the other side, next row, 09:00 and 09:30...
    Thank you!
    swad
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Apr 2010 Link to this post

    Hi Swadesh,

    If you want to configure the RadTimePicker (as described) which is placed on page, then use the settings in order to achieve the same.
    ASPX:
     
    <telerik:RadTimePicker ID="RadTimePicker1" runat="server" Culture="English (United States)"
        <TimeView CellSpacing="-1" Columns="2" EndTime="17:00:00" Interval="00:30:00" StartTime="05:00:00"
        </TimeView> 
    </telerik:RadTimePicker> 


    And if you want to change the timepicker appearance in RadScheduler AdvancedForm, then you could access the control from code behind and set the required properties as shown below.
    CS:
     
        protected void RadScheduler2_FormCreated(object sender, SchedulerFormCreatedEventArgs e) 
        { 
            if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert) 
            { 
                RadTimePicker startPicker = (RadTimePicker)e.Container.FindControl("StartTime"); // Access the start time timepicker 
                // Configure the TimePicker 
                   . . . 
                startPicker.TimeView.StartTime = TimeSpan.FromHours(0); 
                startPicker.TimeView.EndTime = TimeSpan.FromHours(24); 
                startPicker.TimeView.DataList.DataSource = null
                startPicker.TimeView.DataBind(); 
     
     
                RadTimePicker endPicker = (RadTimePicker)e.Container.FindControl("EndTime"); // Access the end time timepicker 
                // Configure the TimePicker 
                   . . . 
                endPicker.TimeView.StartTime = TimeSpan.FromHours(0); 
                endPicker.TimeView.EndTime = TimeSpan.FromHours(24); 
                endPicker.TimeView.DataList.DataSource = null
                endPicker.TimeView.DataBind(); 
            } 
        } 



    Regards,
    Princy.
  3. Allen
    Allen avatar
    111 posts
    Member since:
    Apr 2012

    Posted 14 May 2012 Link to this post

    Can you show me the code in VB.NET?
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 May 2012 Link to this post

    Hello Swadesh,

    Here is the code in VB.
    VB:
    Protected Sub RadScheduler2_FormCreated(sender As Object, e As SchedulerFormCreatedEventArgs)
        If e.Container.Mode = SchedulerFormMode.AdvancedEdit OrElse e.Container.Mode = SchedulerFormMode.AdvancedInsert Then
            Dim startPicker As RadTimePicker = DirectCast(e.Container.FindControl("StartTime"), RadTimePicker)
                   startPicker.TimeView.StartTime = TimeSpan.FromHours(0)
            startPicker.TimeView.EndTime = TimeSpan.FromHours(24)
            startPicker.TimeView.DataList.DataSource = Nothing
            startPicker.TimeView.DataBind()
               Dim endPicker As RadTimePicker = DirectCast(e.Container.FindControl("EndTime"), RadTimePicker)
            endPicker.TimeView.StartTime = TimeSpan.FromHours(0)
            endPicker.TimeView.EndTime = TimeSpan.FromHours(24)
            endPicker.TimeView.DataList.DataSource = Nothing
            endPicker.TimeView.DataBind()
        End If
    End Sub
    Here is converter link.

    Thanks,
    Princy.
Back to Top