How to disable the user input

11 posts, 0 answers
  1. akjoshi
    akjoshi avatar
    26 posts
    Member since:
    Nov 2008

    Posted 19 Dec 2008 Link to this post

    In DatePicker and TimePicker i don't want to allow user to enter date manually, he should be restricted to use the calendar to change the date, how can I do this?

    There should be a property like IsEditable to do this!
  2. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 22 Dec 2008 Link to this post

    Hello there,

    There is a property that I think will do perfect for you. Just set isReadOnly=true. Let me know if this is not fulfilling your needs

    Regards,
    Boyan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WPF is Visual Studio 2017 Ready
  4. akjoshi
    akjoshi avatar
    26 posts
    Member since:
    Nov 2008

    Posted 22 Dec 2008 Link to this post

    Hi Boyan,

    Thanks for the reply, but IsReadOnly is not exactly what I want to do, IsReadOnly disables the input through calendar too; I just want to restrict the input from textbox and not from calendar.

    Something similar is implemented in one of your samples but I am not able to check it as whenever I try to open any file in your samples, VS crashes.

    http://demos.telerik.com/wpf/?Chart/Integration/DeliverySchedule

  5. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 22 Dec 2008 Link to this post

    Hi akjoshi,

    Currently we do not support such a feature, the closest one is the isReadOnly property but when set to false, you can't choose date with the mouse. To achieve what you want, you can delete the 293th line in this file    

    WPF\Input\Themes\DatePicker\Telerik\DatePicker.Styles.xaml :

    IsReadOnly="{TemplateBinding IsReadOnly}"

    Then, just set isReadonly to the Datepicker. Thus, with this custom .dll, you can disable the ReadOnly for the Calendar so that ReadOnly is only the textbox and the picked date will show appropriately in the textbox, however, you won't be able to write in it.
    I attached the modified Telerik.Windows.Controls.Input.dll.

    If you have further problems or this workaround don't fulfill your needs, feel free to write again.

    Greetings,
    Boyan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. BMEA
    BMEA avatar
    6 posts
    Member since:
    Aug 2012

    Posted 24 Jul 2012 Link to this post

    I am not sure if a solution was found for this. I am posting this here so that someone may benefit from it. I found a way to prevent the user from manually entering the date in the RadDateTimePicker. Presumably, this also works in the RadDatePicker. In the DateInput node, set the ReadOnly property to true. The example below demonstrates this

    <telerik:RadDateTimePicker ID="dtpStop" Runat="server">
        <DateInput DisplayDateFormat="d MMM yyyy h:mm tt" ReadOnly="true"></DateInput>
    </telerik:RadDateTimePicker>
  7. Smith
    Smith avatar
    10 posts
    Member since:
    Jul 2012

    Posted 28 Mar 2013 Link to this post

    I couldn't find DateInput property for telerik:RadDatePicker. What property should I use for telerik:RadDatePicker?

  8. Smith
    Smith avatar
    10 posts
    Member since:
    Jul 2012

    Posted 28 Mar 2013 Link to this post

    maybe this could be a solution
    private void filterDate_KeyDown(object sender, KeyEventArgs e)
           {
               e.Handled = true;
           }
  9. Tal
    Tal avatar
    22 posts
    Member since:
    May 2013

    Posted 06 Aug 2013 Link to this post

    Thank you, just what I needed!
  10. BMEA
    BMEA avatar
    6 posts
    Member since:
    Aug 2012

    Posted 06 Aug 2013 Link to this post

    I am happy that you found a work around. For those still not sure how to do this, DateInput is not a property of the date picker but rather a node of it. So if you noticed in the example above, it is a node within the control. On that node, the ReadOnly property is used. I just verified that it exists for the DatePicker, as I had used the DateTimePicker for my example.

    Hope this helps someone
  11. Eddy Mix Inventor
    Eddy Mix Inventor avatar
    1 posts
    Member since:
    Feb 2016

    Posted 30 May in reply to Boyan Link to this post

    ReadOnly="true"

    the above attribute resolved the problem...
    check the sample below for more explaination :

     

      <telerik:RadDatePicker ID="radBirthDate" runat="server" Culture="English (United States)"
                                            Font-Size="14px" Font-Names="Times New Roman" MinDate="1901-01-01" Skin="Office2007"
                                            EnableTyping="False">
                                            <DateInput DateFormat="dd/MM/yyyy" Font-Size="small" ReadOnly="true" runat="server">
                                            </DateInput>
                                            <Calendar Skin="Office2007" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                ViewSelectorText="x" runat="server">
                                            </Calendar>
                                        </telerik:RadDatePicker>

  12. Ruiz
    Ruiz avatar
    1 posts
    Member since:
    Jul 2016

    Posted 20 Jul Link to this post

    I found an easy form that resolved the problem:

    Only you need agregate the propertie EnableTyping="false"  and then the user can´t writte.

    <telerik:RadDatePicker runat="server" ID="rdpExpirationDate" AutoPostBack="false" Width="100%" EnableTyping="False" />

Back to Top
UI for WPF is Visual Studio 2017 Ready