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

the date of day view matches up with the selected date of weekview or monthview

6 Answers 97 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Ming Zhao
Top achievements
Rank 1
Ming Zhao asked on 19 Aug 2010, 02:08 PM
On monthview or weekview, we select a date, eg  8/19/2010,  then we navigate to dayview and we want to see the same selected date 8/19/2010 on dayview.  How can we do this?

It seems that the date shown on dayview is the first date of weekview or monthview when navigating to dayview from weekview or monthview

6 Answers, 1 is accepted

Sort by
0
Ming Zhao
Top achievements
Rank 1
answered on 19 Aug 2010, 08:27 PM
we can use following code to do this  from weekview to dayview:

 

private void radScheduler1_CellClick_1(object sender, SchedulerCellEventArgs e)

 

{


 

SchedulerCellElement ee = e.Cell;

 

ddd = ee.Date;
}

==============================================================

try to use this code to do it but was not good because SchedulerCellElement   returned  by

 

SchedulerUIHelper

 

.GetCellAtPoint

 

 

 is null value

here is code:

 

 

private void radScheduler1_Click_1(object sender, EventArgs e)

 

{

 

Point p = new Point(((MouseEventArgs)e).X, ((MouseEventArgs)e).Y); ;

 

 

SchedulerVisualElement viewe = radScheduler1.SchedulerElement.ViewElement;

 

 

SchedulerCellElement ee = SchedulerUIHelper.GetCellAtPoint(p, viewe.Children)

====================================================
what is the good way to do it?

 

0
Dobry Zranchev
Telerik team
answered on 24 Aug 2010, 07:48 PM
Hello Ming Zhao,

Thank you for writing.

The default behavior of RadScheduler when the view is changed from month to day is to show the start date of the month view. If you want to change this date, you can do it in the ActiveViewChanged event of RadScheduler. You should only set the property StartDate of the scheduler's ActiveView. You can take the selected date with the GetSelectedDates method of the SchedulerUIHelper class. I hope that this information will help you.

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
Ming Zhao
Top achievements
Rank 1
answered on 24 Aug 2010, 08:23 PM

We did  try to implement as you suggest here, but  it aways returns zero selected dates. 

Here are the codes:

 

 

private void radScheduler1_ActiveViewChanged(object sender, SchedulerViewChangedEventArgs e)

 

{

 

DateTime[] selectDates = SchedulerUIHelper.GetSelectedDates(radScheduler1);

 

 

if (selectDates.Length > 0)

 

{

 

DateTime selDt = selectDates[0];

 

}

}

the selectDate.Length never larger than zero, no matter whether  a single  date is selected or mutiple dates are selected (see attached).


Anything which we should adjust here in our codes?

0
Julian Benkov
Telerik team
answered on 27 Aug 2010, 03:28 PM
Hi Ming Zhao,

Thank you for writing us back. When RadScheduler changes its ActiveView the SelectedDates collection is reset. You can handle the ActiveViewChanging event to view/store all selected dates and the ActiveViewChanged event when you want to restore them:

private DateTime[] selectDates = null;
        private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
        {
            SchedulerUIHelper.SelectDates(radScheduler1, selectDates, true);
        }
 
        private void radScheduler1_ActiveViewChanging(object sender, SchedulerViewChangingEventArgs e)
        {
            selectDates = SchedulerUIHelper.GetSelectedDates(radScheduler1);
        }

We will consider adding a property to control this behavior to be like Microsoft Outlook and keep the selection state when switching the view. 

Should you have any further questions, do not hesitate to ask.

Greetings, Julian Benkov
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
Ming Zhao
Top achievements
Rank 1
answered on 27 Aug 2010, 06:02 PM
your suggested codes here do not work for  RadControls_WinForms_2010_2_10_806_dev.


when selectDates= null, SchedulerUIHelper.SelectDates call causes nullReference Exceeption

private
DateTime[] selectDates = null;
        private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
        {
            SchedulerUIHelper.SelectDates(radScheduler1, selectDates, true);
        }
 
        private void radScheduler1_ActiveViewChanging(object sender, SchedulerViewChangingEventArgs e)
        {
            selectDates = SchedulerUIHelper.GetSelectedDates(radScheduler1);
        }
0
Julian Benkov
Telerik team
answered on 02 Sep 2010, 01:48 PM
Hi Ming Zhao,

You can use the following version of the ActiveViewChanged handler:

private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
{
    if(selectDates != null)
    {
        SchedulerUIHelper.SelectDates(radScheduler1, selectDates, true);
    }
}

I hope this helps.

Regards,

Julian Benkov
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
Ming Zhao
Top achievements
Rank 1
Answers by
Ming Zhao
Top achievements
Rank 1
Dobry Zranchev
Telerik team
Julian Benkov
Telerik team
Share this question
or