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

Leading zero for RadMaskedEditBox DateTime formatting

5 Answers 197 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Eric Clemons
Top achievements
Rank 1
Eric Clemons asked on 21 Apr 2010, 05:54 PM
Our client wants to input dates as MM-dd-yyyy with leading zeros.

I have the RadMaskedEditBox set as:
Mask = MM-dd-yyyy
MaskType = DateTime

What setting is missing to force and keep the leading zeros?    (specifically for the month and day)

With the current settings the following behavior occurs as follows:
    1. radMaskedEditBox.Value = someDateTimeObject; results in the leading zero of the month does not show
    2. Typing 0 causes the month mask to collapse to one character. The client expects to see 00 all the time as the 
        double 'M' explicity specifies requiring two digits.
    3. After typing the second digit the zero is not shown.  For example, typing '04' only shows '4'.
    4. The mask sticks on the month, never advancing to the day.  For example, typing '04022009' only results in '9-00-0000'
        as the last digit typed was a nine.

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 27 Apr 2010, 03:25 PM
Hello Eric Clemons,

We have addressed similar issues in our latest release. Could you please download and install our latest version and see whether it works for you?

Thanks for your time.
 

Regards,
Deyan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 19 Feb 2018, 09:05 PM

I'm using the absolute latest version of Telerik and this is still an issue.

Please tell me how I can take a mask of 00-00-0000 and set a RadMaskedEditBox.Value = "01-01-1960"

The desired result would be: "01-01-1960" but the current control returns this: "11-19-60__"

Clearly - not the correct value.

 

Any help would be appreciated.

 

 

0
Hristo
Telerik team
answered on 20 Feb 2018, 03:00 PM
Hello Curtis,

Thank you for writing.

I have tested with the latest R1 2018 version of the assemblies and the specified mask is properly applied:
this.radMaskedEditBox1.MaskType = MaskType.Standard;
this.radMaskedEditBox1.Mask = "00-00-0000";
this.radMaskedEditBox1.Value = "01-01-1960";

I am also attaching a screenshot showing the result on my end. In case you keep experiencing an issue with the leading zeroes in the discussed scenario, please open a support ticket and send us your project.

Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 20 Feb 2018, 04:51 PM

Hello Hristo :)

Your mockup from above does not match the scenario I initially wrote about.

Your code is setting radMaskedEditBox1.Value = a string that's already been formatted.

My code is setting radMaskedEditBox1.Value = a DateTime object.

0
Hristo
Telerik team
answered on 21 Feb 2018, 08:28 AM
Hi Curtis,

Since you are using a DateTime object, you will need to the use the date and time masks and have the control`s MaskType property also set to DateTimehttps://docs.telerik.com/devtools/winforms/editors/maskededitbox/date-and-time-masks.
this.radMaskedEditBox1.MaskType = MaskType.DateTime;
this.radMaskedEditBox1.Mask = "dd-MM-yyyy";
this.radMaskedEditBox1.Value = new DateTime(1960, 1, 1);

I hope this helps. Let me know if you have other questions.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MaskedEditBox
Asked by
Eric Clemons
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Hristo
Telerik team
Share this question
or