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

Get highlighted time??

2 Answers 89 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Mike Baldini
Top achievements
Rank 1
Mike Baldini asked on 23 Jun 2010, 11:21 PM
Is there any way to get the currently highlighted time on the DayView of the RadScheduler?

I have figured out how to get it based on a MouseClick (by handling the radScheduler_CellClick event), but I would like to be able to simply access it when needed rather than handling the mouseclick events.

        void radScheduler1_CellClick(object sender, Telerik.WinControls.UI.SchedulerCellEventArgs e) 
        { 
            if (radScheduler1.ActiveViewType == Telerik.WinControls.UI.SchedulerViewType.Day) 
            { 
                int index = e.Cell.Parent.Children.IndexOf(e.Cell); 
                Telerik.WinControls.UI.SchedulerDayView dv = radScheduler1.GetDayView(); 
                DateTime dtDate = dv.StartDate; 
 
                dtDate = dtDate.AddDays(index % dv.DayCount); 
                index = index / dv.DayCount; 
                 
 
                switch (dv.RangeFactor) 
                { 
                    case Telerik.WinControls.UI.ScaleRange.FiveMinutes: 
                        index *= 5; 
                        break
                    case Telerik.WinControls.UI.ScaleRange.HalfHour: 
                        index *= 30; 
                        break
                    case Telerik.WinControls.UI.ScaleRange.Hour: 
                        index *= 60; 
                        break
                    case Telerik.WinControls.UI.ScaleRange.QuarterHour: 
                        index *= 15; 
                        break
                    case Telerik.WinControls.UI.ScaleRange.SixMinutes: 
                        index *= 6; 
                        break
                    case Telerik.WinControls.UI.ScaleRange.TenMinutes: 
                        index *= 10; 
                        break
                    default
                        break
                } 
 
                dtDate = dtDate.AddMinutes(index); 
                this.Text = "Selected DateTime is " + dtDate.ToString(); 
                //this.Text = "Selected time is " + TimeSpan.FromMinutes(index).Hours.ToString() + ":" + TimeSpan.FromMinutes(index).Minutes.ToString(); 
            } 
        } 

2 Answers, 1 is accepted

Sort by
0
Mike Baldini
Top achievements
Rank 1
answered on 24 Jun 2010, 05:33 PM
Alright... I guess I figured it out.

DateTime[] dt = Telerik.WinControls.UI.SchedulerUIHelper.GetSelectedDates(this.RadScheduler1) 
if (dt.Count == 0) return GetDefaultStartTime() else return dt[0] 

0
Dobry Zranchev
Telerik team
answered on 29 Jun 2010, 02:41 PM
Hi Mike Baldini,

Thank you for contacting us.

I am happy that you found the solution - this is the correct method that you should use. Meanwhile you also could use the GetSelectedCells method of the SchedulerUIHelper class and get the date and time from the cell.

If you have additional questions feel free to write us.

Kind 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
Tags
Scheduler and Reminder
Asked by
Mike Baldini
Top achievements
Rank 1
Answers by
Mike Baldini
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Share this question
or