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

disable many of keys in raddatetimepicker

1 Answer 55 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
amir
Top achievements
Rank 1
amir asked on 01 Mar 2014, 07:11 PM
hi
how to disable many of keys in raddatetimepicker?
I'm using the following code, but I did not give the desired result 

private void DTP_bDate_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = char.IsDigit(e.KeyChar);
        }

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Mar 2014, 03:50 PM
Hello Amir,

Thank you for contacting Telerik Support.

If I understand correctly your requirement, you are trying to stop the user to enter some digits in the RadDateTimePicker. You can achieve this via the 
RadDateTimePicker.DateTimePickerElement.TextBoxElement.KeyPress event:
this.radDateTimePicker1.DateTimePickerElement.TextBoxElement.KeyPress += KeyPress;

private void KeyPress(object sender, KeyPressEventArgs e)
{
    e.Handled = char.IsDigit(e.KeyChar);
}

If it is not the exact requirement, please specify more details about the expected behavior. Thus, we would be able to investigate the precise case and suggest an appropriate solution.

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
amir
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or