This is a migrated thread and some comments may be shown as answers.

set the today button on radgrid datepicker

5 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 12 Jul 2011, 03:32 PM
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.

5 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 18 Jul 2011, 09:04 AM
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!

0
Kevin
Top achievements
Rank 1
answered on 19 Jul 2011, 12:52 PM
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.
0
Mira
Telerik team
answered on 20 Jul 2011, 02:11 PM
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!

0
moegal
Top achievements
Rank 1
answered on 06 Apr 2016, 12:53 PM

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

0
Eyup
Telerik team
answered on 11 Apr 2016, 11:27 AM
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.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Mira
Telerik team
Kevin
Top achievements
Rank 1
moegal
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or