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

Is event 'All Day'

3 Answers 98 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Brad Docimo
Top achievements
Rank 1
Brad Docimo asked on 30 Sep 2008, 09:32 PM
What is the best way to determine if an event is an All Day event from CodeBehind in the AppointmentCreated event?

Thanks,

- Brad

3 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 01 Oct 2008, 02:03 PM
Hello Brad,

If you are not setting the TimeZoneOffset property, then the condition might be as simple as this:

// Starts and ends at midnight 
bool allDay = apt.Start.CompareTo(apt.Start.Date) == 0 && apt.End.CompareTo(apt.End.Date) == 0 

If you are using TimeZoneOffset, then you will have to compensate for it:

DateTime displayStart = RadScheduler1.UtcToDisplay(apt.Start); 
DateTime displayEnd = RadScheduler1.UtcToDisplay(apt.End); 
bool allDay = displayStart.CompareTo(displayStart.Date) == 0 && displayEnd.CompareTo(displayEnd.Date) == 0; 
 

Internally, we use latter code, but we apply it for each day. So, for RadScheduler, an appointment can be an all-day in one day, but not in the next one.

Let us know if you have any other questions.

Sincerely yours,
Tsvetomir Tsonev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
pat
Top achievements
Rank 1
answered on 30 Mar 2009, 11:16 AM
Hi,
This is fine that an all day appointment starts and ends at mid night.
what i set to acheive this  is as follows:
in the appointmentBound event,
 e.Appointment.Start = e.Appointment.Start;
 e.Appointment.End = e.Appointment.Start.AddHours(24);
  Now when i click any appointment template,in EditAppointment template, it sets all-day checkbox as checked(as expected) but shows the time range too along with date(which is not expected) like: from 30march 2009 12:00am to 30march 2009 12:00am .
with this view, all-day checkbox eventhandling does not happen.
plus, when i export this appointment to ical file, it shows me all-day event checkbox as unchecked and now the timing is like this:
from 30march 2009 12:00am to 31march 2009 12:00am .
why there is such inconsistency in behaviour?
can you please explain and suggest the work around for this?

0
bad nick
Top achievements
Rank 1
answered on 19 Jun 2009, 11:27 AM
Tsvetomir,

// Starts and ends at midnight  
bool allDay = apt.Start.CompareTo(apt.Start.Date) == 0 && apt.End.CompareTo(apt.End.Date) == 0  

the above code is incorrect if you create a n-day event that starts and ends at 12AM.

For example , I create an event that starts on 20/06/2009 12AM ends on 24/06/2009 12AM every week - this should create a timed recurring event that lasts for 4 days every week.
Tags
Scheduler
Asked by
Brad Docimo
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
pat
Top achievements
Rank 1
bad nick
Top achievements
Rank 1
Share this question
or