RadDateTimePicker read only with popup

5 posts, 0 answers
  1. Gary
    Gary avatar
    20 posts
    Member since:
    Dec 2012

    Posted 13 May 2013 Link to this post

    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.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gary
    Gary avatar
    20 posts
    Member since:
    Dec 2012

    Posted 14 May 2013 Link to this post

    Perfect, Shinu
    Thanks for the suggestion.  It worked great!
  5. Shahi
    Shahi avatar
    17 posts
    Member since:
    Apr 2013

    Posted 15 May 2013 Link to this post

    Hi shinu, Can i remove the popup icon?
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 May 2013 Link to this post

    Hi,

    Try overriding the default CSS as follows.

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

    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017