How to set the SelectedDate but still display the EmptyMessage on a RadTimePicker

4 posts, 0 answers
  1. Michael Malone
    Michael Malone avatar
    68 posts
    Member since:
    May 2010

    Posted 12 Dec 2012 Link to this post

    I have a unique situation. We are developing a Timecard Entry system with "Time In" and "Time Out" pickers for each day of the week. I have attached a screenshot for reference. When a blank timecard initially loads, the time pickers should have an empty message of "Time In" and "Time Out" accordingly. I do this by settings the DateInput.EmptyMessage property. When a user selects the Time In/Out values, the DATE portion of the time picker needs to be the date corresponding to the day of the week. Instead, each time picker's date is always defaulted to TODAY's date. The only way I know to change this default behavior is to manually set the "SelectedDate" property on each time picker for each day of the week but then I lose my EmptyMessage of "Time In" or "Time Out".  My question is, is there a way to set the SelectedDate property but not have it actually be visually "selected" per se? I need the time pickers to display the EmptyMessage when the page loads. But I still need to have full control over which date the control uses when something is selected.
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 13 Dec 2012 Link to this post

    Hello Michael,

    You can handle the RadTimePicker's OnDateSelected ClientEvent and to change the Date of the selected date.
    http://www.telerik.com/help/aspnet-ajax/calendar-on-date-selected.html

    Regards,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Michael Malone
    Michael Malone avatar
    68 posts
    Member since:
    May 2010

    Posted 19 Dec 2012 Link to this post

    How do you reset the date for a RadTimePicker in Javascript? I've tried the following inside the OnDateSelected ClientEvent but it doesn't seem to be updating the SelectedDate value when I check it after a postback.

    var timePickerIn = $find("<%=tcForm.SatTimeInTimePicker.ClientID %>");
    var timeInAdjusted = new Date(y, m, d, h, min);
    timePickerIn.set_selectedDate(timeInAdjusted);
  5. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 24 Dec 2012 Link to this post

    Hi Michael,

    This demo shows how to use the set_selectedDate, and it is working correct. Essentially it it the same way as you do it so I am not sure why you are facing an issue. Check the demo's source code and see what is different in your code.
    http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/clientapi/defaultcs.aspx

    All the best,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top