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

Set MaskedDateTimeInput Text property doesn't affect the value

1 Answer 51 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Kryon Systems
Top achievements
Rank 1
Kryon Systems asked on 08 Nov 2015, 01:12 PM

Hi,

I'm migrating from RadMaskedTextBox to the new mask controls and encountered the following problem with MaskedDateTimeInput.

Up until now I used to set the "Text" property of the control, because my data structure holds the value as string with the correct format.

When I try setting the "Text" property of MaskedDateTimeInput via code to a certain date string, it doesn't affect the "Value" property.

When I click on the control it changes the text back to the current date.

 

I know I can use the value property but that requires me to convert my text value into DateTime and I don't want to do that if it can be done automatically via the control. 

Please advice

1 Answer, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 11 Nov 2015, 09:21 AM
Hi Oren ,

You should use the Value property to pass your desired DateTime value to the masked control. The Text property is only a visual representation of the Value that gets displayed in the control when it isn't focused.

Another approach would be to use the RadMaskedTextInput control instead. Just pass the text value you already have formatted to the Value property of the masked control along with no mask ( Mask="" ).

Hope this helps.

Regards,
Peshito
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Kryon Systems
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Share this question
or