RadDateTimePicker won't update when used in a hosted item in RadCommandBar

2 posts, 0 answers
  1. Matt
    Matt avatar
    10 posts
    Member since:
    Sep 2010

    Posted 19 Feb 2012 Link to this post

    I have a RadDateTimePicker being used inside a hosted item on a RadCommandBar. It shows up fine, and is operational, but if I set the value on the RadDateTimePicker at runtime, it doesn't update. The value property of the RadDateTimePicker does get updated, just not visually on the form. Is there a workaround for this?

    I'm using 2011.3.11.1229 of the Telerik controls for WinForms.

    Here is the code I'm using to create the RadDateTimePickers and assign them to the hosted item:

            Dim raddatetimepicker_from As Telerik.WinControls.UI.RadDateTimePickerElement
            Dim raddatetimepicker_thru As Telerik.WinControls.UI.RadDateTimePickerElement

            'Create RadDataimePickers
            raddatetimepicker_from = New Telerik.WinControls.UI.RadDateTimePickerElement
            raddatetimepicker_thru = New Telerik.WinControls.UI.RadDateTimePickerElement
            raddatetimepicker_thru.MaxDate = DateTime.Today

            'Format RadDateTimePickers and insert into host
            Dim SizeDTP As New System.Drawing.Size
            SizeDTP.Height = 0
            SizeDTP.Width = 95

            raddatetimepicker_from.MinSize = SizeDTP
            raddatetimepicker_thru.MinSize = SizeDTP

            raddatetimepicker_from.Format = DateTimePickerFormat.Short
            raddatetimepicker_thru.Format = DateTimePickerFormat.Short

            'Assign to hosted item on command bar
            cbhi_from_date.HostedItem = raddatetimepicker_from
            cbhi_thru_date.HostedItem = raddatetimepicker_thru

    Here is the code I am using to assign the value, which doesn't cause the RadDateTimePicker to visually update:

            raddatetimepicker_from.Value = DateTime.Now.AddDays(DaysBack * -1)

    Any help would be great, don't want to have to fallback to the standard DateTimePicker because I don't believe I can host that in a RadCommandBar. Maybe there is some sort of a "refresh" function I should be using, but I haven't needed to do this in the past when the RadDateTimePicker is just on a regular form instead of inside a hosted item.
  2. Peter
    Peter avatar
    1148 posts

    Posted 21 Feb 2012 Link to this post


    Thank you for writing and for the provided details.

    Using your code snippet, I was not able to reproduce the issue (see the screenshot)
    I am attaching my sample test form - could you modify it in order to reproduce the issue?

    I am looking forward to your response.

    Kind regards,
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. DevCraft banner
Back to Top