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

Restrict access to the textbox in DateTimePicker

1 Answer 96 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Lasse
Top achievements
Rank 1
Lasse asked on 08 Aug 2012, 01:44 PM
Hi, 
I want to restrict access, or be able to remove the edit function to the Textbox in the DateTimePicker.
I tried to hook into the  TextChanging Event of th radDateTimePicker1.DateTimePickerElement.TextBoxElement and set the e.cancel = true. No visible changes was made when trying to edit the text, but it seems like it set some date in behind anyway.

I could do Enabled = false on the TextBoxElement, but then the control seems locked and I want the user to be able to push the dropdown button and select the date from the calendar. 

Is there any good way to restrict this access?

Regards
Svein Thomas

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 13 Aug 2012, 09:41 AM
Hello Svein,

Thank you for writing.

Yes, there is a way to do this. You can set the text box to be read only. Here is how to do that:
radDateTimePicker1.DateTimePickerElement.TextBoxElement.TextBoxItem.ReadOnly = true;

I hope that this will work for you. Let us know if you have any other questions.

Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Lasse
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or