Calendar Date doesnt change on navigation

5 posts, 0 answers
  1. Haroon Khokhar
    Haroon Khokhar avatar
    13 posts
    Member since:
    Jul 2009

    Posted 24 Sep 2009 Link to this post

    Hi All,

    When ever we use navigation controls on calendar to move to a different month or a year, the calendar's SelectedDate object doesnt get updated and it keeps the value of the last selected Date. Why is that so?

    Can anyone please explain this happens and is there a way to select the first day of the month everytime the calendar is moved to a different month?

    Thanks in advance,

    Haroon
  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 25 Sep 2009 Link to this post

    Hello Haroon,

    RadCalendar provides a collection of dynamic templates that customize the presentation of calendar days on a "per day" basis.
    For a live example please review the following link:
    Special Days and templates

    Kind regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Haroon Khokhar
    Haroon Khokhar avatar
    13 posts
    Member since:
    Jul 2009

    Posted 27 Sep 2009 Link to this post

    Hi Pavlina,

    Your solution visually selects the day you want to highlight, but still when i move to a different month, the system doesnt update the SelectedDate object and shows the last selected Date. The only way to update the SelectedDate object is to manually select the date after navigating to a new month. For a user, as soon as a calendar is navigated to a new month, the system should automatically know that a new date has been selected.

    So is there any way i could get the new date when calendar is navigated from the default view?

    Waiting for your reply.

    Haroon
  4. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 28 Sep 2009 Link to this post

    Hi Haroon,

    To clear the last selected Date on navigation I suggest you try the code snippet bellow:
    ASPX:
    <telerik:RadCalendar ID="RadCalendar1" runat="server" AutoPostBack="true" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged">     
            </telerik:RadCalendar> 

    C#
    protected void RadCalendar1_DefaultViewChanged(object sender, Telerik.Web.UI.Calendar.DefaultViewChangedEventArgs e)  
        {  
            RadCalendar1.SelectedDates.Clear();  
        } 

    Please give this suggestion a try and see if it works for you.

    Sincerely yours,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Haroon Khokhar
    Haroon Khokhar avatar
    13 posts
    Member since:
    Jul 2009

    Posted 28 Sep 2009 Link to this post

    Hi Pavina,

    The RadCalendar1.SelectedDates.Clear(), still doesnt resolve my problem of finding the new date when calendar is navigated to a new month/year.

    Anyways I firgured out the solution myself. For anyone concerned, we can retrieve the new date value espacially the month and year data by accessing e.NewView.NextView.ViewStartDate under RadCalendar1_DefaultViewChanged event handler function. In my scenario, when ever use moves to a new month/year, I select the first day of the month, and capture the new month and year from e.NewView.NextView.ViewStartDate object.




Back to Top