Completed
Last Updated: 04 Dec 2020 10:39 by ADMIN
Dan
Created on: 20 May 2015 15:03
Category: Scheduler
Type: Feature Request
1
current time and date indicator

		
1 comment
ADMIN
Rumen
Posted on: 04 Dec 2020 10:39

Hi Ian,

To highlight the current date and time you could apply CSS styles on the time slot. Here is a similar forum thread How to change background color of current date in rad scheduler week view mode. In the OnTimeSlotCreated server-side event handler, you could check the date and time and if the TimeSlot is the desired one you could set its CssClass property as in the provided forum thread or the documentation article.

Set a custom CSS class to the timeslot that covers the current date and then with JavaScript to scroll the timeslot to be visible: 

protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{
    if (e.TimeSlot.Start <= DateTime.Now && DateTime.Now <= e.TimeSlot.End)
    {
        e.TimeSlot.CssClass = "current-time";
    }
}
<script>
    function f() {
        setTimeout(function () {
            if ($telerik.$(".rsContentWrapper .current-time")[0]) {
                $telerik.$(".rsContentWrapper .current-time")[0].scrollIntoView();
            }
        }, 10);
        // Sys.Application.remove_load(f); 
    }
    Sys.Application.add_load(f);
</script>

 

Regards,
Rumen
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.