Today button in Calender

6 posts, 1 answers
  1. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 12 Jan 2010 Link to this post

    Hi, I am trying to have a "today" button in datepicker (and maybe in radcalnder as well)
    how would I archive this (at moment, to go to today, need to select month-today) 
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jan 2010 Link to this post

    Hello James,

    I accomplished the same by placing button in FooterTemplate of Calendar in datepicker, then set the date in the click handler of button.

        <telerik:RadDatePicker ID="RadDatePicker10" runat="server" Width="140px"
            <Calendar runat="server"
                    <div style="width: 100%; text-align: center; background-color: Gray;"
                        <input id="Button1" type="button" value="Today" onclick="GoToToday()" /> 

        function GoToToday() { 
            var datepicker = $find("<%=RadDatePicker10.ClientID%>"); 
            var dt = new Date(); 

  3. James Shelton-Agar
    James Shelton-Agar avatar
    108 posts
    Member since:
    May 2008

    Posted 24 Jan 2010 Link to this post

    works great! thank you for the tip
  4. Michael Veltre
    Michael Veltre avatar
    2 posts
    Member since:
    Sep 2009

    Posted 06 Oct 2014 in reply to Shinu Link to this post

    How can I accomplish the same function server side?
  5. Eyup
    Eyup avatar
    4027 posts

    Posted 09 Oct 2014 Link to this post

    Hi Michael,

    You can use the SpecialDays collection to achieve this requirement:

    Hope this helps.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  6. IT-Fjárvakur
    IT-Fjárvakur avatar
    6 posts
    Member since:
    Jul 2015

    Posted 03 Mar 2017 in reply to Eyup Link to this post

    A small update

    This solution does not work when RadDatePicker is bound in edittemplates in grid and such. Also, if you have multiple RadDatePickers (like date from and date to) you might end up with a huge switch/case or if/else if/else which is not really scalable.

    My solution was to change the onClick function so it takes in a parameter.
    This is somewhat of a "hack" but since there is only one popup calendar available when you open up your the datepicker, just select the first one. That leaves you with the RadCalender and you can set the date from there.

    Btw - it's 2017. Telerik should add this function to calendar pick both server and client side.

    <input id="Button1" type="button" value="Today" onclick="GoToToday(this)" />

    function GoToToday(aButtonNode)
                var _calenders = $(".RadCalendarPopupShadows");
                var _today = new Date();
                var todayTriplet = [_today.getFullYear(), _today.getMonth() + 1, _today.getDate()];
                $find(_calenders[0].childNodes[0].id).selectDate(todayTriplet, true);
Back to Top