Selecting already selected day in selection list without removing it

1 posts, 0 answers
  1. Andre M
    Andre M avatar
    3 posts
    Member since:
    Nov 2009

    Posted 16 Dec 2009 Link to this post

                    Hello everyone,

     

                    I was having troubles using the Calendar control. Here is what was happening and how did I manage to solve it:

     

                    At some point, using a dropdown list, I could select a different number of days I would like to see in a RadScheduler and select in a RadCalendar those days (current selected day + number of days – 1). This way, I could get a list of selected days, e.g, 14th ,15th ,16th and 17th in the calendar and see the appointments for those dates in the RadScheduler. If the next step was to select one of the days that was already selected, e.g 16th  – for viewing purposes, I would in fact deselect it and the day would be removed from the list, e.g. 14th,15th and 17th. In the server side I couldn’t figure out what day was removed (if the unselected was the first or the last date)  so I managed to update the selection on the client-side (removing all the dates and adding the “unselected one”). Here is what I did:

     

                   

              function DateSelected(sender, eventArgs) {

                    var day = eventArgs.get_renderDay();

                    var calendar = $find("<%=RadCalendar1.ClientID%>");

                    var dates = calendar.get_selectedDates();

                    calendar.unselectDates(dates);

     

                    var date = day.get_date();

                    sender.set_focusedDate(date);

     

     

     

                    calendar.updated();

                }

     

    ….          

     

                                    And added on the RadCalendar: ClientEvents-OnDateClick="DateSelected"

                   

                                    Feel free to comment this or others solutions.

     

    Cheers,

     

    AM

Back to Top