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

[Solved] Set appointment as allday

4 Answers 143 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 14 May 2009, 02:35 PM
Hi

Is there an easy way of setting an appointment as an allday event? or do i have to set the start and end variables to specific date/times to get this to work?

Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 14 May 2009, 02:45 PM
Hello Greg,

You need to set the Start and End dates to specific values. Namely, the start datetime should be 12 am of the current day, and the end datetime should be 12 am the day after. For example:

 protected void Page_Load(object sender, EventArgs e)  
    {  
        Appointment allDayAppointment = new Appointment();  
        allDayAppointment.Subject = "All day appointment for May 15, 2009";  
        allDayAppointment.Start = new DateTime(2009, 5, 15, 0, 0, 0);  
        allDayAppointment.End = new DateTime(2009, 5, 16, 0, 0, 0);  
        RadScheduler1.InsertAppointment(allDayAppointment);  
 
    } 


All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andrew
Top achievements
Rank 1
answered on 14 May 2009, 03:17 PM
Hi

I have done that , yet the appointment still doesnt show as an all day event. I have added
ShowAllDayRow="true" 
 yet it only shows the appointment in the day view at 1pm even tho the time is 00:00:00 in the record i am inserting fomr both start and end date

Thank
0
Peter
Telerik team
answered on 16 May 2009, 01:31 PM
Hello Greg,

Are you setting the TimeZoneOffset property? If yes, you should take this into consideration. For example:
 protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!IsPostBack)  
        {  
            Appointment allDayAppointment = new Appointment();  
            allDayAppointment.Subject = "All day appointment for May 15, 2009";  
              
            DateTime allDayStart = new DateTime(2009, 5, 16, 0, 0, 0);  
            DateTime allDayStartAdjusted = allDayStart.Subtract(RadScheduler1.TimeZoneOffset);  
 
            DateTime allDayEnd = new DateTime(2009, 5, 17, 0, 0, 0);  
            DateTime allDayEndAdjusted = allDayEnd.Subtract(RadScheduler1.TimeZoneOffset);  
 
            allDayAppointment.Start = allDayStartAdjusted;  
            allDayAppointment.End = allDayEndAdjusted;  
            RadScheduler1.InsertAppointment(allDayAppointment);     
 
        }  
          
    } 


Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andrew
Top achievements
Rank 1
answered on 16 May 2009, 02:04 PM
Hi

Setting the end date fixed the problem

Thanks
Tags
Scheduler
Asked by
Andrew
Top achievements
Rank 1
Answers by
Peter
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or