New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Pick a Timeline Item If the Items Are Aligned Left or Right


Product Telerik UI for ASP.NET MVC Timeline
Progress Telerik UI for ASP.NET MVC version Created with the 2022.2.621 version


How can I pick an item if the items are aligned left or right in the Timeline?


To achieve the desired scenario:

  1. Add a Boolean property to the Model of the Timeline that will indicate whether a particular timeline event will be displayed on the left or right.
  2. Subscribe to the DataBound event of the Timeline.
  3. Within the function handler:

    1. Get the current records through the method.
    2. Iterate through each of the items.
    3. Get the unique identifier for the currently rendered list item.
    4. Add or remove the k-reverse class generated for the position of the current list item and based on the isLeft field of the state mentioned previously.
    5. To ensure proper stylization regarding the cards, update the card callout classes.

    public class TimelineEventModel
        public bool isLeft { get; set; }

            //additional configuration...

    function onDataBound(){
         for(var i = 0; i < items.length; i++){ 
               var item = items[i]; 
               var uidAttr = kendo.attr('uid');
               var element = this.element.find('li[' + uidAttr + '=' + item.uid + ']');
               var isLeft = item.isLeft;

               element.toggleClass("k-reverse", isLeft);
                        .toggleClass('k-callout-e', isLeft)
                        .toggleClass('k-callout-w', !isLeft);

More ASP.NET MVC Timeline Resources

See Also

In this article