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

RadDateTimePicker read only with popup

4 Answers 140 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Gary
Top achievements
Rank 1
Gary asked on 13 May 2013, 08:43 PM
Hello all
Before I start creating my own code, is there a proper way to lock the user from manualy entering a date & time in the textbox, but forcing them to use the popup pickers?

I have tried Readonly but then I can not use ShowPopupOnFocus="true"
I have tried EnableTyping="false" but then I can not use ShowPopupOnFocus="true"

What I'd like to see is when the user clicks the textbox, the calendar pops up and they can choose a date, then they can click the time button that pops up the time picker and change the time, but they can not type a date or a time into the box.

Any thoughts would be helpfull.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 May 2013, 04:34 AM
Hi Gary,

Please have a look at the following code I tried which works fine at my end. On clicking the textbox, the calendar pops up and the user can choose a date. The user wont be able to type anything inside the textbox as you expected.

ASPX:
<telerik:RadDatePicker ID="RadDatePicker1" runat="server" DateInput-ClientEvents-OnFocus="OnFocus" DateInput-ClientEvents-OnKeyPress="OnKeyPress">
</telerik:RadDatePicker>

JavaScript:
<script type="text/javascript">
    function OnFocus(sender, args) {
        var datePicker1 = $find('<%=RadDatePicker1.ClientID %>');
        datePicker1.showPopup();
    }
    function OnKeyPress(sender, args) {
        args.set_cancel(true);
    }
</script>

Thanks,
Shinu.
0
Gary
Top achievements
Rank 1
answered on 14 May 2013, 02:02 PM
Perfect, Shinu
Thanks for the suggestion.  It worked great!
0
Shahi
Top achievements
Rank 1
answered on 15 May 2013, 05:35 AM
Hi shinu, Can i remove the popup icon?
0
Shinu
Top achievements
Rank 2
answered on 15 May 2013, 06:00 AM
Hi,

Try overriding the default CSS as follows.

CSS:
<style type="text/css">
    .RadPicker .rcCalPopup, .RadPicker .rcTimePopup
    {
        display:none !important;
    }
</style>

Thanks,
Shinu.
Tags
Calendar
Asked by
Gary
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Gary
Top achievements
Rank 1
Shahi
Top achievements
Rank 1
Share this question
or