Setting SelectedDate but control focus is not changing

5 posts, 0 answers
  1. Jeff Reinhardt
    Jeff Reinhardt avatar
    55 posts
    Member since:
    Oct 2009

    Posted 24 May 2010 Link to this post

    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?

  2. Rama
    Rama avatar
    20 posts
    Member since:
    Apr 2008

    Posted 25 May 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeff Reinhardt
    Jeff Reinhardt avatar
    55 posts
    Member since:
    Oct 2009

    Posted 25 May 2010 Link to this post

    Thank you, that worked.  My only question is why the calendar does not do this automatically for selected date being set in the codebehind?
  5. Rama
    Rama avatar
    20 posts
    Member since:
    Apr 2008

    Posted 25 May 2010 Link to this post

    Sorry sir I am not Telerik developer i am just customer like u.... :)  
  6. Espen Fosshaug
    Espen Fosshaug avatar
    18 posts
    Member since:
    Sep 2009

    Posted 15 Sep 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017