Set default time on DateTimePicker

10 posts, 1 answers
  1. Jeff Tang
    Jeff Tang avatar
    54 posts
    Member since:
    Jun 2008

    Posted 17 Jun 2009 Link to this post

    My situation is that I want the time of the DateTimePicker can be filled with 23:59 when the user only use the popup calendar to select a date but haven't selected the time in the TimeView. And the user can also type in the datetime in the textbox to change the value, but in this case won't fill in 23:59. Can anyone have any solution? Thanks.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2009 Link to this post

    Hi Jeff Tang,

    You can review the following code library submission which will help you set a default time to the RadDateTimePicker.
    Set default time in RadDateTimePicker

    Thanks,
    Princy.
  3. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 18 Jun 2009 Link to this post

    Hello Jeff,

    Please find attached a simple runnable application that demonstrates the desired functionality. Give it a try and see if it works for you or if I am leaving something out.

    I hope this helps.

    Sincerely yours,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. Jeff Tang
    Jeff Tang avatar
    54 posts
    Member since:
    Jun 2008

    Posted 18 Jun 2009 Link to this post

    Thank you for your reply. In fact I also use the same method to set the default time, but the main problem is that when the user want to change the time by typing, the event also triggered to set the time to 23:59, thus the user can't change the time by keyborad.
  5. Jeff Tang
    Jeff Tang avatar
    54 posts
    Member since:
    Jun 2008

    Posted 18 Jun 2009 Link to this post

    Thank you for your reply. In fact I also use the same method to set the default time, but the main problem is that when the user want to change the time by typing, the event also triggered to set the time to 23:59, thus the user can't change the time by keyborad.
  6. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 19 Jun 2009 Link to this post

    Hi Jeff,

    I am sending you a modified project.
    Please give it a try and let me know if this is the expected behavior.

    Kind regards,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Jeff Tang
    Jeff Tang avatar
    54 posts
    Member since:
    Jun 2008

    Posted 19 Jun 2009 Link to this post

    Thank you for your reply. However, it's not a completed solution for me. Let me further explain my target behavior.

    - At anytime when the textbox is blank, and the user click on the calendlar, the time will be set to 23:59.
    - At anytime when the textbox is blank, and the user type in only the date part,  the time will also be set to 23:59.
  8. Answer
    Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 24 Jun 2009 Link to this post

    Hi Jeff,

    I am afraid that the desired functionality could be hardly achieved with RadDateTimePicker control. It is a limitation of the client events of the control and we could not differentiate when user want to change the time/date by keyboard, or click on the calendar.

    I will gladly assist you if other questions arise.

    Sincerely yours,
    Pavlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Randy
    Randy avatar
    23 posts
    Member since:
    Jul 2012

    Posted 08 Mar 2010 Link to this post

    Wow, I really see this limitation as a really short sidedness ont he datetimepicker control.  I don't understand why the control doesn't have a default time property that we can set in design time?  For example:  DefaultSelectedTime="23:59:59" or something like that.  Telerik should be able to put logic in there control that when the user selects the date or types in the date that it automatically sets the date/time value with the DefaultSelectedTime attribute.  What are your thoughts Telerik?  I think this is a common need.  I create parameter pages for people to execute reports and I could see where this is needed.  Yes, I know we can write logic when the date is passed to the data layer params to add the 23:59:59 to the date, but seriously, should the UI controls tell the data what the correct parameters are?  If this was a web service, I should have to tell my web service consumers that I will automatically append the 23:59:59, I want them to specify the exact time they want the data.

    Anyways...
  10. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 09 Mar 2010 Link to this post

    Hello Randy,

    I am sending you a simple working application which handles the required functionality. Please give it a try and let me know if it works as expected or if I am leaving something important out.

    I hope this helps.

    Regards,
    Pavlina
    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