Elegant solution for RadDateTimePickers?

2 posts, 0 answers
  1. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 12 Dec 2013 Link to this post

    I have an app where the user selects a From Date/Time and a To Date/Time. The default time on the End needs to be 23:59. Consider that if the user selects the same date in both controls that they intend to mean the entire day, not 12am to 12am of the same day. And it's a bit much to ask them to select the next day so that they get 12am of the next day.

    So we're looking for a default of:
    From 12/12/2013 00:00 to 12/12/2013 23:59

    How do I set that? For the RadDateTimePicker, if I use markup to set the DateInput SelectedDate to "23:59", assuming the current date will get substituted, it still defaults to current date 00:00. Anything I set there is not used, like SelectedDate="01/01/2014 06:00AM". I know the default value for DateInput is MinDate, but I don't want to set a MinDate of "from date 23:59" because that will preclude setting to an earlier time of day.

    Also, assume the user selects 21:00 but then they really want to change it to "end of day". Do I need to create a custom list in the TimeView which will allow them to select various times, including a final 23:59?

    Rather than trying to accommodate such nuances, I'm wondering if there is a better solution. For example, I can code some post-processing logic that says "if the start and end-time are both 00:00 of the same day, then make the To time 23:59" for subsequent queries, or we can simply not use the time component if the date and tie are the same and the time is 00:00.

    Thanks for your consideration. And I hope this help someone else who is working out a From/To scenario.
  2. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 17 Dec 2013 Link to this post

    This code sample seems to be the solution:

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top