set the today button on radgrid datepicker

6 posts, 0 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 12 Jul 2011 Link to this post

    When you click and open a radgrid date picker, you need to click on the date at top to get another window to open so that you can pick the button with todays date.

    1.  How do you seet that button with todays date.  I went into the properties but can never find the right syntax for it to take.
    2. Is there a way to put it on the datepicker at the bottom such as the Microsoft one that has it at the bottom so there is no need to pick agian to get to todays date button.
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 18 Jul 2011 Link to this post

    Hello Kevin,

    I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

    I hope it helps.

    Best wishes,
    Mira
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 19 Jul 2011 Link to this post

    Hi,
    I get an error that says it cannot find my date control.  I think this is because it sits inside a Radgrid.  Is there not a properties setting for the today button on the raddate picker???  the MS calendar control has thid built in so when you pick on todays date it fills in automatically, I would think that radpicker control would automatically provide the same functionality.
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 20 Jul 2011 Link to this post

    Hello Kevin,

    The Today button functionality can be easily achieved with the following code:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function setToday(sender) {
                sender.parentNode.parentNode.parentNode.parentNode.control.selectDate([new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDay() + 1], true);
            }              
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
        <Calendar>
            <HeaderTemplate>
                <asp:Button Text="Today" OnClientClick="setToday(this);" runat="server" />
            </HeaderTemplate>
        </Calendar>
    </telerik:RadDatePicker>

    It will work even if the datepicker is nested inside other controls.

    I hope this helps.

    Best wishes,
    Mira
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 06 Apr in reply to Mira Link to this post

    I can't get this to work and I get an error if I use a telerik RadPushButton.

     

    I am using this in a radgrid

    Any ideas?

    Marty

  7. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 11 Apr Link to this post

    Hello Moegal,

    As stated in the documentation, the " templates can contain regular HTML, including text, images, hyperlinks, and so on". However, they cannot contain complex server-side controls. Therefore, I suggest that you use a simpler input as demonstrated in the attached web site sample.

    Regards,
    Eyup
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017