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

Displaying selected appointment problem.

3 Answers 111 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Phillip Foster
Top achievements
Rank 1
Phillip Foster asked on 07 May 2010, 08:43 PM
Me Again!!
I don't know if i'm doing something wrong, or if this is a bug. 
I am trying to make my scheduler only show a given appointment.
I wanted to display the hour before and after the appointment. To do so I am using this code:

private void showAppointment(DateTime dt1) 
            rsAppointments.ActiveView.StartDate = Convert.ToDateTime(dt1.ToShortDateString()); 
            ((SchedulerDayView)rsAppointments.ActiveView).RulerStartScale = dt1.Hour - 1; 
            ((SchedulerDayView)rsAppointments.ActiveView).RulerEndScale = dt1.AddMinutes(Convert.ToDouble(appointDuration)).Hour + 1; 

It works fine the first time its called, however after its been called a few times, it starts showing more and more time and will show the 3-6 hours before the appointment. 

Any suggestions?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 10 May 2010, 02:51 PM
Hello Phillip Foster,

Thank you for contacting us.

In order to do this, we will suggest using another approach (although we will research why this is happening in your case).

We will suggest scrolling to the time slot that you need by using the ScrollToTime method:
 
SchedulerDayViewElement dayViewElement = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement);
TimeSpan time = new TimeSpan(1, 0, 0);
dayViewElement.DataAreaElement.Table.ScrollToTime(time);
 
You could take the SchedulerDayViewElement only from DayView, WeekView or WorkWeekView. As to changing the start date your code is correct.

I hope this will help. If your have other questions feel free to ask.

Regards,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Phillip Foster
Top achievements
Rank 1
answered on 10 May 2010, 03:16 PM
hi, thank you for replying!

However this doesn't seem to work for me. I maybe doing something wrong. 
Here is my code. it does seem to go to that appointment, but the scroll doesn't seem to move to make it visible. 

            rsAppointments.ActiveView.StartDate = Convert.ToDateTime(dt1.ToShortDateString()); 
                         
            SchedulerDayViewElement dayViewElement = (this.rsAppointments.SchedulerElement.ViewElement as SchedulerDayViewElement); 
            TimeSpan time = new TimeSpan(dt1.Hour, 0, 0); 
            dayViewElement.DataAreaElement.Table.ScrollToTime(time); 
 
 
            this.rsAppointments.Appointments.BeginUpdate(); 
            nextAppoint = CreateAppointment(dt1, appointDuration, null, AppointmentType.NextAvail); 
            selectedAppoint = nextAppoint; 
            this.rsAppointments.Appointments.Add(nextAppoint); 
            this.rsAppointments.Appointments.EndUpdate(); 

0
Dobry Zranchev
Telerik team
answered on 11 May 2010, 09:17 AM
Hello Phillip Foster,

The method ScrollToTime moves the scrollbar to the position where the start hour is visible. I think that you should use the following code snippet to achieve your scenario:
 
DateTime dt1 = this.radScheduler1.ActiveView.StartDate.AddDays(5).AddHours(15);
this.radScheduler1.ActiveView.StartDate = dt1.Date;
 
SchedulerDayViewBase dayView = this.radScheduler1.ActiveView as SchedulerDayViewBase;
dayView.RulerStartScale = dt1.Hour - 1;
dayView.RulerEndScale = dt1.Hour + 2;
 
SchedulerDayViewElement dayViewElement = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement);
TimeSpan time = new TimeSpan(dt1.Hour, 0, 0);
dayViewElement.DataAreaElement.Table.ScrollToTime(time);
 
After this code snippet you need to create your appointment. I hope this will help you.

All the best,
Dobry Zranchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Scheduler and Reminder
Asked by
Phillip Foster
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Phillip Foster
Top achievements
Rank 1
Share this question
or