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

How to disable the user input

10 Answers 1043 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
akjoshi
Top achievements
Rank 1
akjoshi asked on 19 Dec 2008, 04:09 PM
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!

10 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 22 Dec 2008, 08:25 AM
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.
0
akjoshi
Top achievements
Rank 1
answered on 22 Dec 2008, 09:27 AM
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

0
Boyan
Telerik team
answered on 22 Dec 2008, 04:25 PM
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.
0
BMEA
Top achievements
Rank 1
answered on 24 Jul 2012, 05:06 PM
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>
0
Smith
Top achievements
Rank 1
answered on 28 Mar 2013, 06:58 AM
I couldn't find DateInput property for telerik:RadDatePicker. What property should I use for telerik:RadDatePicker?

0
Smith
Top achievements
Rank 1
answered on 28 Mar 2013, 06:59 AM
maybe this could be a solution
private void filterDate_KeyDown(object sender, KeyEventArgs e)
       {
           e.Handled = true;
       }
0
Tal
Top achievements
Rank 1
answered on 06 Aug 2013, 10:12 AM
Thank you, just what I needed!
0
BMEA
Top achievements
Rank 1
answered on 06 Aug 2013, 01:11 PM
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
0
Eddy Mix
Top achievements
Rank 1
answered on 30 May 2016, 07:15 PM

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>

0
Ruiz
Top achievements
Rank 1
answered on 20 Jul 2016, 04:58 PM

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" />

Tags
DatePicker
Asked by
akjoshi
Top achievements
Rank 1
Answers by
Boyan
Telerik team
akjoshi
Top achievements
Rank 1
BMEA
Top achievements
Rank 1
Smith
Top achievements
Rank 1
Tal
Top achievements
Rank 1
Eddy Mix
Top achievements
Rank 1
Ruiz
Top achievements
Rank 1
Share this question
or