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

Setting SelectedDate but control focus is not changing

4 Answers 147 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Jeff Reinhardt
Top achievements
Rank 1
Jeff Reinhardt asked on 24 May 2010, 03:31 PM
I have two Calendar Controls on a page for Start and End Dates for a scheduling app.  In the page load I am setting the dates that are saved in the database as such:

radcalStartDate.SelectedDate = oSurvey.StartDate;

radcalEndDate.SelectedDate = oSurvey.EndDate;


The dates get selected fine, however, if the dates are in future months there is an issue.

for example the Start Date is June 15, the End Date is June 30...  the dates themselves are selected but when the page renders the calendar controls are still focused on the current month of May.  I have to go forward a month in order to see the selected dates.  How can I get the controls to focus on the month where the day is selected?

4 Answers, 1 is accepted

Sort by
0
Rama
Top achievements
Rank 1
answered on 25 May 2010, 03:41 PM
Try this

<rad:RadCalendar ID="selectionRadCalendar" runat="server" AutoPostBack="true" EnableMultiSelect="true" ClientEvents-OnLoad="OnCalendarLoad" OnSelectionChanged="OnSelectionRadCalendar_SelectionChanged">
        </rad:RadCalendar>


function OnCalendarLoad(sender, eventArgs)
 {
    sender.selectDates(sender.get_selectedDates(), true);
 }

Thanks
Pradeep
0
Jeff Reinhardt
Top achievements
Rank 1
answered on 25 May 2010, 05:24 PM
Thank you, that worked.  My only question is why the calendar does not do this automatically for selected date being set in the codebehind?
0
Rama
Top achievements
Rank 1
answered on 25 May 2010, 08:37 PM
Sorry sir I am not Telerik developer i am just customer like u.... :)  
0
Espen Fosshaug
Top achievements
Rank 1
answered on 15 Sep 2010, 09:49 PM
Hi.

You can use the property FocusedDate on the Calendar. This will set the Calendar to the right month.
To also highlight the date use SelectedDate as well.
Tags
Calendar
Asked by
Jeff Reinhardt
Top achievements
Rank 1
Answers by
Rama
Top achievements
Rank 1
Jeff Reinhardt
Top achievements
Rank 1
Espen Fosshaug
Top achievements
Rank 1
Share this question
or