This is a migrated thread and some comments may be shown as answers.

how to change the items in start and end time combobox in appointment insert and edit view?

5 Answers 113 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
sf
Top achievements
Rank 1
sf asked on 09 Apr 2010, 08:04 AM
how to change the items in start and end time combobox in appointment insert and edit mode?
it currently only shows time items between 8am and 5:30 pm. I need it to show time items through out 24 hours

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Apr 2010, 11:33 AM

Hello,

I tried following code in order to customize the TimePicker options in AdvanedInsert and AdvancedEdit form.

C#:

 
    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");  
            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");  
            endPicker.TimeView.StartTime = TimeSpan.FromHours(0);  
            endPicker.TimeView.EndTime = TimeSpan.FromHours(24);  
            endPicker.TimeView.DataList.DataSource = null;  
            endPicker.TimeView.DataBind();  
        }  
    } 

Hope this helps,

hinu.

0
sf
Top achievements
Rank 1
answered on 12 Apr 2010, 02:39 AM
hi Shinu thank you very much it worked.
Just one additional question: how can I set the default selected time in these 2 RadTimePickers? e.g. the default selected StartTime is 13:00 and the default selected EndTime is 18:00
0
Shinu
Top achievements
Rank 2
answered on 12 Apr 2010, 08:37 AM

Hi,

You can set the SelctedDate property of the RadTimePickers as shown below.

C#:

 
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");  
            startPicker.TimeView.StartTime = TimeSpan.FromHours(0);  
            startPicker.TimeView.EndTime = TimeSpan.FromHours(24);  
 
            startPicker.SelectedDate = new DateTime(e.Appointment.Start.Year, e.Appointment.Start.Month, e.Appointment.Start.Day, 13, 0, 0);  
 
            startPicker.TimeView.DataList.DataSource = null;  
            startPicker.TimeView.DataBind();  
 
            RadTimePicker endPicker = (RadTimePicker)e.Container.FindControl("EndTime");  
            endPicker.TimeView.StartTime = TimeSpan.FromHours(0);  
            endPicker.TimeView.EndTime = TimeSpan.FromHours(24);  
 
            endPicker.SelectedDate = new DateTime(e.Appointment.End.Year, e.Appointment.End.Month, e.Appointment.End.Day, 18, 0, 0);  
 
 
            endPicker.TimeView.DataList.DataSource = null;  
            endPicker.TimeView.DataBind();  
        }  
    } 

-Shinu.

0
GISWebDev
Top achievements
Rank 2
answered on 17 Jan 2011, 04:45 AM
Shinu,
Thanks for this post.  I'm interested in setting a 'default' time frame for appointments. For instance I'd like to have the opening time be at 8am and the ending appt box read +5 hours (1pm).  In addition, if I changed the 8am start time to 9am I'd like the end time to auto-set to +5hrs (2pm).  Before saving the user could set the end date to a shorter or longer appt time.  The purpose is to establish a default appt time frame of 5 hrs.  Anything you could point me to before rewriting what's probably a simple task and done before?  I'm learning the API ;)
Thanks in advance,
Todd 
0
Peter
Telerik team
answered on 17 Jan 2011, 11:43 AM
Hi sf,

You can set NumberOfHoveredRows="10" for RadScheduler or you can handle FormCreating like this:

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
    {
        if (e.Mode == SchedulerFormMode.AdvancedInsert || e.Mode == SchedulerFormMode.Insert)
        {
            e.Appointment.End = e.Appointment.Start.AddHours(5);
        }
    }


Kind regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
sf
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
sf
Top achievements
Rank 1
GISWebDev
Top achievements
Rank 2
Peter
Telerik team
Share this question
or