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

Problem defaulting RadCalendar to a Month other than current Month

1 Answer 108 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Unified Development
Top achievements
Rank 1
Unified Development asked on 22 Oct 2009, 04:19 PM
I have a RadCalendar that I want to prevent users from going back to any date in the past (prior to the current month). I understand that this can be achieved by setting the RangeMinDate to DateTime.Today effectively.

I also stop users from navigating the RadCalendar out further than Three months. This is done by RadCalendar.RangeMaxDate = now.AddMonths(3);

I serve all events that show on each day of the calendar from a webservice.

So, if you viewed the calendar today (10/22/09) you would see all scheduled events for the month of October. If you tried to navigate back to September it will stop you. You can navigate all the way up to January 2010 and see events that correspond to each month, but any further progression would be stopped. Now, as each month is loaded (utilizing the DefaultViewChanged method) I call a web service to load up the next months events. This is achieved by asking the RadCalendar for the FocusedDate. This all works great until the following.

Each displayed event is clickable and when clicked takes a user to a new page to view all of the event details. No problem there until we try to return the user back to the calendar. So imagine you loaded the calendar today, navigated forward to December. You click on an event. You now want to return to calendar. What is happening is when the user returns to the page with the RadCalendar on it it displays the Month of October again, I want it to display December and not October. Additionally, the only way I can get the RadCalendar to display December is to set the RangeMinDate to December, but of course that then stops the user from navigating back to October.

So, my question is how can I on load of the RadCalendar force it to render correctly so that all fwd and backwards navigation works correctly to a date other than the current month?

1 Answer, 1 is accepted

Sort by
0
Johny
Top achievements
Rank 1
answered on 28 Oct 2009, 09:31 AM
Hi Derek,

Why don't you try to save the focused date of the calendar in the session on DefaultViewChanged event handler. Then on PageLoad you can check if the page is requested from another page and if so just apply the saved focused date from the session.

Thanks,
Johny
Tags
Calendar
Asked by
Unified Development
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Share this question
or