Set MaskedDateTimeInput Text property doesn't affect the value

2 posts, 0 answers
  1. Oren Keinan
    Oren Keinan avatar
    2 posts
    Member since:
    May 2009

    Posted 08 Nov 2015 Link to this post


    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

  2. Peshito
    Peshito avatar
    524 posts

    Posted 11 Nov 2015 Link to this post

    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.

    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
Back to Top