bug: InputMode="DatePicker" when DateTimeText binding c# DateTime still show time

2 posts, 0 answers
  1. Missing user
    Missing user avatar

    Posted 23 Jan 2013 Link to this post

    in demo, set inputMode to DatePicker, it will show date only, but when binding DateTimeText to a c# DateTime value , the inputmode will auto change to DateTimePicker. I think it is a bug.

  2. Georgi
    Georgi avatar
    344 posts

    Posted 25 Jan 2013 Link to this post

    Hello Hui,

    As DateTimeText is a string property it seems like when DateTime is converted to the string the time is also converted. So what you can try is using StringFormat when you convert the DateTime to string and hide the time.
    Also you can manipulete the CultureInfo for example:
    CultureInfo info = new System.Globalization.CultureInfo("en-US");
               info.DateTimeFormat.LongDatePattern = "M/d/yy";
               dateTimePicker.Culture = info;

    Nevertheless if you don't need specifically to use the DateTimeText you can use SelectedValue.
    If you have any troubles with implementing one of the above suggestions it would be best if you can send us more info about your scenario so we would be able to provide you with more detailed help.

    Kind regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top