RadDatePicker and RadTimePicker to use same date

4 posts, 0 answers
  1. Stephen
    Stephen avatar
    158 posts
    Member since:
    Jan 2009

    Posted 30 Apr 2010 Link to this post

    Hello,

    I have a RadDatePicker and two RadTimePickers on a page.  Is there any built-in way to link the selected date of the RadTimePickers to the selected date of the RadDatePicker so when they go to chose the time from the RadTimePicker it doens't change the date back to today's date?

    I know that I can get the selected date from the RadDatePicker on autopostback and then set the selected date on the RadTimePickers to that date.  But then when you chose the time from the RadTimePicker it sets the date back to today's date.

    Thanks.
  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 30 Apr 2010 Link to this post

    Why don't you just use two RadDateTimePicker controls. That way it will retain the selected date. Or when you save you could create new datetime objects with the selected date like so:

    DateTime selectedDate = RadDatePicker.SelectedDate.Value; 
    DateTime selectDateTime1 = new DateTime(selectedDate.Year, selectedDate.Month, selectedDate.Day, 
    RadTimePicker1.SelectedDate.Value.Hour, RadTimePicker1.SelectedDate.Value.Minute,0); 
     
    // perform code to save selected date and times 

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stephen
    Stephen avatar
    158 posts
    Member since:
    Jan 2009

    Posted 30 Apr 2010 Link to this post

    Thank you for the reply.

    I need to only have one date appear so the first option is out.  The second method is what I am doing, just maipulating the info before I save.  I just thought there might be a way to automatically hook the date of the timepicker to the date of a datepicker, maybe through a property.
  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 06 May 2010 Link to this post

    Hello Stephen,

    There is no built-in functionality to link the dates in such manner. Unfortunately, Robert's suggestion is the only feasible option I can think of for this scenario.

    Let me know if you need more information.

    Best regards,
    Daniel
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top