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

Masking in RadDatePicker's dateinput

5 Answers 245 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sachin
Top achievements
Rank 1
Sachin asked on 03 Jun 2009, 01:09 PM
Hi,

I want the (default value on load in)rendering in datepicker to be __/__/__ on load, and user should be able to insert dates, without having to enter the '/'. I am using Telerik Q1 2009.

I learn from the forum that raddatepicker's dateinput had this property which was removed in the later version to apply free form logic.

In one of the threads, you have explained how to achieve this on blur.

I would like to do this on load (and not on blur). Is there way to do this, without writing the masking logic in javascript ?

Thanks & Regards,
Sachin

5 Answers, 1 is accepted

Sort by
0
Sachin
Top achievements
Rank 1
answered on 04 Jun 2009, 01:14 PM
Hi All,

If there is a javascript to help me achieve this, I'm ok with that too!

Thanks in advance,
Sachin
0
Veli
Telerik team
answered on 08 Jun 2009, 11:30 AM
Hi Sachin,

We have Code Library article showing you how to replace RadDatePicker's default input box with a regular ASP.NET TextBox control. Starting from that example, I have created a small page demonstrating how to replace the input control of a RadDatePicker with a RadMaskedTextBox control for which you can easily set an input mask.

The idea is to hide your default input box for the date picker, and bind your custom input control to the picker using client API. You need to handle three points of execution:

1. When the popup is displayed, we need it below the custom input control
2. When a date is selected, we need to display its value in the custom input
3. When a date is entered manually, we need to parse it and set the date picker's selected date

You can take a look at the sample page and see how this solution works for you.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Sachin
Top achievements
Rank 1
answered on 09 Jun 2009, 05:30 AM
Many Thanks Veli! This looks good.
I will try it in my solution and let you know.

Thanks & Regards,
Sachin

0
Sachin
Top achievements
Rank 1
answered on 03 Aug 2012, 11:02 AM
Hi Team,

Would it be possible to have the mask based on the culture applied to the datepicker?
ex. "/" for US "-" for Portuguese ?

Regards
Sachin
0
Vasil
Telerik team
answered on 06 Aug 2012, 12:09 PM
Hello Sachin,

Yes is it possible. You can either set the Mask in the code behind by checking the culture first. Or use the property localization provided in the ASP.

All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Input
Asked by
Sachin
Top achievements
Rank 1
Answers by
Sachin
Top achievements
Rank 1
Veli
Telerik team
Sachin
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or