How to set a default Date on Month or Year Navigation of the radCalendar

2 posts, 0 answers
  1. Vinu
    Vinu avatar
    3 posts
    Member since:
    May 2011

    Posted 30 Jul 2011 Link to this post

    Hai,

    I have a problem with telerik ajax "Calendar".

    I managed to set the "DateTime.now" on the page load and it is working perfectly for me.

    But the problem is when I click to Navigate using the "prev month, prev year, next month or next year" a "default date is to be selected", instead here the prevoiusly selected date (that is DateTime.now value) exists if any one one of the "Navigation is clicked".

    Actually I want a postback on the calendar click and I am plannning to load the data correspending to the "Selected Date". But here the selected date doesnot change on the Navigation Click.

    You can see the "system calender" set a default value on the Navigation click to "default 1 st day of the corresponding Month and year".

    Is it possible to set a default date on the Navigation month and year click. This is very much needed for this.

    And as a workaround "Can we manage to set a default date on the clientside of the navigation cllick"

    Any Help is appreciated,

    ,

    Vinu
  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 04 Aug 2011 Link to this post

    Hello Vinu,

    You can achieve the default date selection on navigating the calendar using script similar to:
    <script type="text/javascript">
        var currentDate;
        function selectDate(sender, eventArgs) {
            if (currentDate) {
                sender.unselectDate(currentDate);
            }
                currentDate = sender.get_focusedDate();
                sender.selectDate(sender.get_focusedDate()); 
        }
    </script>

    You should call this function on the client CalendarViewChanged event.

    Best wishes,
    Tsvetina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top