New to Telerik UI for ASP.NET CoreStart a free 30-day trial

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

Environment

ProductTelerik UI for ASP.NET Core Timeline
Progress Telerik UI for ASP.NET Core versionCreated with the 2022.2.621 version

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

Model.cs

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

More ASP.NET Core Timeline Resources

See Also