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

[Solved] RadScheduler.StartTime/EndTime Issue

3 Answers 368 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
jeremy
Top achievements
Rank 1
jeremy asked on 11 Oct 2007, 01:44 AM

private Model.Schedule schedule = BusinessCalls.ScheduleBusinessCalls.GetSchedule();

TimeSpan startTime = new TimeSpan(schedule.ScheduleStartDate.Hour, schedule.ScheduleStartDate.Minute, schedule.ScheduleStartDate.Second);

TimeSpan endTime = new TimeSpan(schedule.ScheduleEndDate.Hour, schedule.ScheduleEndDate.Minute, schedule.ScheduleEndDate.Second);

RadScheduler1.DayStartTime=startTime;

RadScheduler1.DayEndTime=endTime;

RadScheduler1.MinutesPerRow=schedule.ScheduleTimeSlotIncrements;

RadScheduler1.DataStartField="appointmentStarting";

RadScheduler1.DataSubjectField="appointmentSubject";

RadScheduler1.DataEndField="appointmentEnding";

RadScheduler1.DataKeyField="appointmentID";

RadScheduler1.DataSource=appointments;

RadScheduler1.DataBind();

My schedule object has a schedule.StartDate of 10/10/2007 09:00AM
My schedule object has a schedule.EndDate of 17/10/2007 05:00PM

I make 2 timespan objects with these 2 times above and that will be my start and end times per day until schedule expires.

If I run as this, it runs correctly and the start/end times are correct however the dayHeader date is datetime.now (whatever my local time is)

So if I change the dayheader.selectedDate to schedule.ScheduleStartDate (by default the dayHeaderFormat is "D") or DateToLongString() my date displays how i want it to however, now my start and end times change to 6pm - 2am.

I'm really not sure what is going on?  I tried to timezoneoffset and the times did not change.

Thanks in advance,
Jeremy

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 11 Oct 2007, 11:37 AM
Hello Jeremy,

Could you please specify the exact steps needed to reproduce the problem. In particular we are not sure about this part:

"If I run as this, it runs correctly and the start/end times are correct however the dayHeader date is datetime.now (whatever my local time is)

So if I change the dayheader.selectedDate to schedule.ScheduleStartDate (by default the dayHeaderFormat is "D") or DateToLongString()
"

What exactly do you set? Can you send us the code? Ideally, you can send us a simple project demonstrating the issue.



Waiting for your reply,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jeremy
Top achievements
Rank 1
answered on 11 Oct 2007, 05:30 PM
Peter,

Thank you for your reply.  I was in the process of creating a test project to send you and I managed to resolve my issue.  The problem was when I was setting the RadScheduler1.SelectedDate property, I was saying set it:
RadScheduler1.SelectedDate = MySchedule.scheduleStartDate;

The problem was scheduleStartDate was of of full DateTime IE (10/17/2007 9:00AM) so my actual RadScheduler1.DayStartTime was 12:00PM instead of the 9:00AM i wanted.  I changed the line of code in red above to:

RadScheduler1.SelectedDate = MySchedule.scheduleStartDate.Date;

Adding the .Date at the end returned the date portion of the DateTime object which was what I wanted.

Thanks,
Jeremy
0
Peter
Telerik team
answered on 12 Oct 2007, 10:03 AM
Hello Jeremy,

Good to hear that you solved the problem. We appreciate your feedback. 

 

All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Scheduler
Asked by
jeremy
Top achievements
Rank 1
Answers by
Peter
Telerik team
jeremy
Top achievements
Rank 1
Share this question
or