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

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Telerik UI for ASP.NET MVC Timeline</td>
 </tr>
 <tr>
  <td>Progress Telerik UI for ASP.NET MVC version</td>
  <td>Created with the 2022.2.621 version</td>
 </tr>
</table>

## Description

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

## Solution

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:

4. Get the current records through the [`dataSource.data()`](https://docs.telerik.com/kendo-ui/api/data/datasource/methods/data) method.

5. Iterate through each of the items.

6. Get the unique identifier for the currently rendered list item.

7. 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.

8. To ensure proper stylization regarding the cards, update the card callout classes.

```C# Model.cs

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

```

```Razor Timeline.cshtml

    @(Html.Kendo().Timeline<TimelineDemoApp.Models.TimelineEventModel>()
            .Name("Timeline")
            .Events(e=>e.DataBound("onDataBound"))
            //additional configuration...
    )

```

```JS script.js

    function onDataBound(){
         var items=this.dataSource.data(); 
         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);
               element.find('.k-card-callout')
                      	.toggleClass('k-callout-e', isLeft)
                      	.toggleClass('k-callout-w', !isLeft);
         }
    }

```

## More ASP.NET MVC Timeline Resources

* [ASP.NET MVC Timeline Documentation](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/navigation/timeline/overview)

* [ASP.NET MVC Timeline Demos](https://demos.telerik.com/aspnet-mvc/timeline)

* [ASP.NET MVC Timeline Product Page](https://www.telerik.com/aspnet-mvc/timeline)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Client-Side API Reference of the Timeline for ASP.NET MVC](https://docs.telerik.com/kendo-ui/api/ui/timeline)
* [Server-Side API Reference of the Timeline for ASP.NET MVC](https://docs.telerik.com/aspnet-mvc/api/timeline)
* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)
* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
