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

Calendar Date doesnt change on navigation

4 Answers 42 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Haroon Khokhar
Top achievements
Rank 1
Haroon Khokhar asked on 24 Sep 2009, 07:07 AM
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

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 25 Sep 2009, 02:47 PM
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.
0
Haroon Khokhar
Top achievements
Rank 1
answered on 28 Sep 2009, 02:34 AM
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
0
Pavlina
Telerik team
answered on 28 Sep 2009, 02:24 PM
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.
0
Haroon Khokhar
Top achievements
Rank 1
answered on 29 Sep 2009, 01:23 AM
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.




Tags
Calendar
Asked by
Haroon Khokhar
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Haroon Khokhar
Top achievements
Rank 1
Share this question
or