# ASP.NET Core Timeline Overview

The Telerik UI Timeline TagHelper and HtmlHelper for ASP.NET Core are server-side wrappers for the Kendo UI Timeline widget.

The Timeline widget displays a collection of events and their data in a chronological succession for each year.

You can scroll through the events and collapse/expand them. The events order can be vertical or horizontal, and you can customize their templates, as well as respond to events and use API control the widget behavior. You can also control the format of the rendered date for the event. If you provide a list of actions, they will be rendered as links after the description and images.

* [Demo page for the Timeline HtmlHelper](https://demos.telerik.com/aspnet-core/timeline/index)

* [Demo page for the Timeline TagHelper](https://demos.telerik.com/aspnet-core/timeline/tag-helper)

![UI for ASP.NET Core Timeline Overview](https://www.telerik.com/aspnet-core-ui/documentation/assets/010d334c1642c52adca39bb17642cfc5/timeline-overview.png)

## Initializing the Timeline

The following example demonstrates how to define the Timeline. Note the tabs for the controller and model code that show how to feed data to the widget.

```Razor HtmlHelper
    @(Html.Kendo().Timeline<MyApp.Models.TimelineEventModel>()
               .Name("Timeline")
               .DataDateField("EventDate")
               .DataDescriptionField("Description")
               .DataSubTitleField("Subtitle")
               .DataTitleField("Title")
               .DataImagesField("Images")
               .DataActionsField("Actions")
               .Orientation("vertical") // defines the layout of the widget
               .AlternatingMode() // renders the events on both sides of the axis in vertical mode
               .CollapsibleEvents() // starts all events collapsed in vertical mode
               .DataSource(dt => dt.Read("GetTimelineData", "Timeline"))
    )
```

```Razor TagHelper
    <kendo-timeline name="Timeline"
                    orientation="vertical"
                    datadatefield="EventDate"
                    datatitlefield="Title"
                    datasubtitlefield="Subtitle"
                    datadescriptionfield="Description"
                    dataactionsfield="Actions"
                    dataimagesfield="Images"
                    alternating-mode="true"
                    collapsible-events="true">
        <datasource>
            <transport>
                <read url="@Url.Action("GetTimelineData","Timeline")" />
            </transport>
            <schema>
                <model>
                    <fields>
                        <field name="EventDate" type="date"></field>
                        <field name="Title" type="string"></field>
                        <field name="Subtitle" type="string"></field>
                        <field name="Description" type="string"></field>
                    </fields>
                </model>
            </schema>
        </datasource>
    </kendo-timeline>
```

```C# Controller
public partial class Timeline : BaseController
{
    public JsonResult GetTimelineData()
    {
        List<TimelineEventModel> events = new List<TimelineEventModel>();

        events.Add(new TimelineEventModel() {
            Title = "Barcelona \u0026 Tenerife",
            Subtitle = "May 15, 2015",
            Description = "First event description.",
            EventDate = new System.DateTime(2015, 4, 15),
            Images = new List<TimelineEventImageModel>() {
                new TimelineEventImageModel() { src = "https://demos.telerik.com/aspnet-mvc/tripxpert/Images/Gallery/Barcelona-and-Tenerife/Arc-de-Triomf,-Barcelona,-Spain_Liliya-Karakoleva.JPG?width=500&amp;height=500" }
            },
            Actions = new List<TimelineEventActionModel>() {
                new TimelineEventActionModel() { text = "More info about Barcelona", url="https://en.wikipedia.org/wiki/Barcelona" }
            }
        });

        events.Add(new TimelineEventModel()
        {
            Title = "United States East Coast Tour",
            Subtitle = "Feb 27, 2018",
            Description = "The second event description.",
            EventDate = new System.DateTime(2018, 1, 27),
            Images = new List<TimelineEventImageModel>() {
                new TimelineEventImageModel() { src = "https://demos.telerik.com/aspnet-mvc/tripxpert/Images/Gallery/United-States/Boston-Old-South-Church_Ivo-Igov.JPG?width=500&amp;height=500" }
            },
            Actions = new List<TimelineEventActionModel>() {
                new TimelineEventActionModel() { text = "More info about New York City", url="https://en.wikipedia.org/wiki/New_York_City" }
            }
        });

        events.Add(new TimelineEventModel()
        {
            Title = "Malta, a Country of Knights",
            Subtitle = "My second trip this year",
            Description = "Third event description.",
            EventDate = new System.DateTime(2015, 5, 25),
            Images = new List<TimelineEventImageModel>() {
                new TimelineEventImageModel() { src = "https://demos.telerik.com/aspnet-mvc/tripxpert/Images/Gallery/Malta/Bibliotheca-National-Library_Marie-Lan-Nguyen.JPG?width=500&amp;height=500" }
            },
            Actions = new List<TimelineEventActionModel>() {
                new TimelineEventActionModel() { text = "More info about Malta", url="https://en.wikipedia.org/wiki/Malta" }
            }
        });

        
        return Json(events);
    }
}
```

```C# Model
public class TimelineEventModel
{
    public string Title { get; set; }
    public string Subtitle { get; set; }
    public string Description { get; set; }

    public DateTime EventDate { get; set; }

    public List<TimelineEventImageModel> Images { get; set; }
    public List<TimelineEventActionModel> Actions { get; set; }
}

public class TimelineEventImageModel
{
    public string src { get; set; } // this field name must be "src"
}
public class TimelineEventActionModel
{
    public string text { get; set; } // this field name must be "text"
    public string url { get; set; } // this field name must be "url"
}
```

## Functionality and Features

* [Orientation](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/orientation)
* [Actions](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/actions)
* [Images](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/images)
* [Templates](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/templates)

## Next Steps

* [Getting Started with the Timeline](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/getting-started)
* [Basic Usage of the Timeline for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/timeline/index)
* [Timeline Events](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/events)

## See Also

* [Basic Usage of the Timeline (Demo)](https://demos.telerik.com/aspnet-core/timeline/index)

* [Basic Usage of the Timeline TagHelper (Demo)](https://demos.telerik.com/aspnet-core/timeline/tag-helper)

* [Timeline in Razor Pages](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/timeline/razor-pages)

* [Using the Events of the Timeline (Demo)](https://demos.telerik.com/aspnet-core/timeline/events)

* [Applying the Timeline API (Demo)](https://demos.telerik.com/aspnet-core/timeline/api)

* [JavaScript API Reference of the Timeline](https://docs.telerik.com/kendo-ui/api/ui/timeline)
