Unable to set Display text on DateTimePicker

4 posts, 0 answers
  1. Rod Yager
    Rod Yager avatar
    79 posts
    Member since:
    May 2010

    Posted 26 Jun 2012 Link to this post

    I am trying to set the value property in code on the DateTimePicker (Input mode is Time Picker). It looks like the value is being set properly but I never see anything displayed in the UI. I have tried to set the RadDateTimePicker.DateTimeText and that doesn't seem to work either. ???

    Thanks,
    Rod
    RadDateTimePicker dayEndTimePicker = new RadDateTimePicker();
                dayEndTimePicker.InputMode = Telerik.Windows.Controls.InputMode.TimePicker;
                dayEndTimePicker.MinWidth = 75.0;
                dayEndTimePicker.MaxWidth = 75.0;
                dayEndTimePicker.SelectionChanged += new SelectionChangedEventHandler(dayEndTimePicker_SelectionChanged);
                string endTime = GetScreenSettingValue("DayEndTime", "18:00:00", false);
                string[] endTimeSplit = endTime.Split(new Char[] { ':' });
                dayEndTimePicker.SelectedValue = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(endTimeSplit[0]), Convert.ToInt32(endTimeSplit[1]), Convert.ToInt32(endTimeSplit[2]));
                dayEndTimePicker.DateTimeText = dayEndTimePicker.SelectedValue.Value.ToShortTimeString();
  2. Vladi
    Admin
    Vladi avatar
    749 posts

    Posted 29 Jun 2012 Link to this post

    Hello Rod,

    I tried to reproduce the issue but couldn't, here is a sample code that represents how to declare a RadDateTimePicker with SelectedValue from the code behind:

    RadDateTimePicker radDateTimePicker = new RadDateTimePicker()
    {
        InputMode = Telerik.Windows.Controls.InputMode.TimePicker,
        SelectedValue= new DateTime(2012, 6, 29, 14, 20, 0, 0)
    };

    Hope this helps.

    All the best,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. ENRIQUE
    ENRIQUE avatar
    1 posts
    Member since:
    Apr 2020

    Posted 05 May 2020 in reply to Vladi Link to this post

    Hi.
    I am updating the version of the controls from 2010 to 2020.
    The same happens to me with MVVM. But if I change the InputMode to "DatePicker" the control shows data.
    In the 2010 version this did not happen and the control showed data with both InputMode.

     

  4. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    764 posts

    Posted 08 May 2020 Link to this post

    Hello Enrique,

    I tested the scenario in a sample project, however the SelectedValue is displayed in the RadDateTimePicker when the InputMode is TimePicker. That is why I am attaching the project that I used for testing purposes. Can you check it out and see how it differs from the setup on your end?

    Should you need any further assistance, you can modify it in order to replicate the observed on your end behavior and send it back in a new support ticket (since project files cannot be attached to forum posts). This will allow me to investigate further and better assist you.

    Regards,
    Vladimir Stoyanov
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
Back to Top