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

Scheduler Selected View and date range is reset on an F5 Refresh

5 Answers 72 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Michael Hunt
Top achievements
Rank 1
Michael Hunt asked on 07 Oct 2010, 03:42 PM
Hi,

I'm using the 2010.2.826.35 version of the ASP.NET for AJAX controls.  I'm new to the Scheduler, and assume this is a simple question but couldn't find a KB article or forum post that answers it.

My Scenario:
- When my page loads, the Scheduler shows the current month as expected (it is in MonthView).
- Then I scroll to a new month (or even switch to week view and scroll to any week).
- If I hit F5 to do a page refresh in the browser, the Scheduler again shows the current month.

What I want it to do, is continue to show the correct timeline and date range that I was currently looking at.

Q.  What is the recommended way of doing that?

Do I store the SelectedView type and the date range in hidden fields, and read them and set the appropriate properties of the Scheduler?

Thanks,
Michael

5 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 13 Oct 2010, 11:41 AM
Hello Michael Hunt,

Please accept my apologies for the late reply.

Yes, this is expected behavior that when you refresh a page or redirect from another page  RadScheduler returns to initial SelectedView or SelectedDate.

One possible way to store them is to use a hidden field as you suggested. Other option is to store them in a cookie. Here's an example:

you can subscribe to the NavigationComplete event to store the SelectedDate of the scheduler. Here's the code:

Copy Code
protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
    {
        if (e.Command == SchedulerNavigationCommand.NavigateToSelectedDate)
        {
            HttpCookie cookie = new HttpCookie("selectedDate");
            cookie.Value = RadScheduler1.SelectedDate.ToString();
            Response.SetCookie(cookie);
        }
    }

then you can read the cookie in Page_PreRender event:

Copy Code
protected void Page_PreRender(object sender, EventArgs e)
    {
        if (Request.Cookies["selectedDate"] != null)
        {
            RadScheduler1.SelectedDate = DateTime.Parse(Request.Cookies["selectedDate"].Value);
        }
    }

Please let me know if this was helpful.

Best Regards,
Veronica Milcheva
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
Michael Hunt
Top achievements
Rank 1
answered on 12 Nov 2010, 08:55 PM
Actually, I just getting back into working on this, and the proposed solution isn't exactly what I want.

I want to be able to set the set the visible start and end dates on the scheduler.  The scenario is this:

  User is looking at Month View, for the Month of November.
  User navigates to October and the scheduler displays Sept 27th - Nov 5th (since it displays the entire first and last week of October, it also displays the end of Sept and the beginning of November).
  User navigates away from the scheduler page (at which time I save their SelectedView and Visible Start and End Dates).
  User then navigates back to the Scheduler page.

In server side code, I set the SelectedView to Month and the SelectedDate to September 27th.

PROBLEM:
Now the scheduler displays the month of September.
But I wanted to display the month of October.

It's strange that I can set the SelectedView, but I can't set the start and end date range I want to display.  Seems like a useful feature.

How can I accomplish this?

Thanks,
Michael.
0
Michael Hunt
Top achievements
Rank 1
answered on 12 Nov 2010, 09:17 PM
Please disregard my previous post.  I've figured it out.  For month view, I'll just make sure and save the first day of the current month I've viewing, as my selected date...

Thanks.
0
Sandy
Top achievements
Rank 1
answered on 07 Mar 2012, 05:45 PM
Hi
I am using Rad Scheduler.I set Rad scheduler default view to Month.when I select in scheduler to day view or week view and then navigate to another page and i come bak it is loading as month view only how can I get the view which i was in when i was leaving the page.
Thank you.
0
Plamen
Telerik team
answered on 12 Mar 2012, 01:33 PM
Hello Sandy,

 
I have tested the code that was posted by Veronica when the page is redirected and then used the back button and also refreshed the page with F5, but everything worked as expected. I am attaching a working sample that reproduces this behavior. Would you please explain how is your case different?

Kind regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Michael Hunt
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Michael Hunt
Top achievements
Rank 1
Sandy
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or