Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Scheduler / How to scroll into view a specific time slot on initial page load

How to scroll into view a specific time slot on initial page load

Article Info

Rating: 4

Article information

Article relates to

 RadScheduler 

Created by

 Peter, Telerik

Last modified

 Feb 5, 2010

Last modified by

 Ves, Telerik


HOW TO

Scroll into view a specific time slot on initial page load.

DESCRIPTION

This KB article shows how to scroll to the 8AM time slot on initial page load. The CssClass property of the 8AM time slot is set to "TimeSlotCssFor8AM" in the TimeSlotCreated event handler. Then, using javascript the table cell (td) element of the specific time slot is found by its ClassName and the scrollIntolView() method is called.

Scroll into view the 8am time slot

SOLUTION

code-behind:
protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)  
{  
    if (e.TimeSlot.Start.Hour == 8)  
        e.TimeSlot.CssClass = "TimeSlotCssFor8AM";  

aspx:
<script type="text/javascript">       
function pageLoad()       
{       
    var scheduler = $find('<%= RadScheduler1.ClientID %>');       
    var scrolledIntoViewSlot = $telerik.getElementByClassName(scheduler.get_element(), "TimeSlotCssFor8AM""td");       
    if(scrolledIntoViewSlot)     
      setTimeout(function(){ scrolledIntoViewSlot.scrollIntoView();}, 200);      
}         
 

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.