ASP.NET MVC Timeline Overview
The Telerik UI Timeline HtmlHelper for ASP.NET MVC is a server-side wrapper 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.
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.
@(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"))
)
Functionality and Features
Referencing Existing Instances
To access an existing Timeline instance, use the .data()
jQuery method, executed by the jQuery object of the originating element. Once you have the reference, you can use the Timeline client-side API.
@(Html.Kendo().Timeline<MyApp.Models.TimelineEventModel>()
.Name("Timeline")
.DataDateField("EventDate")
.DataDescriptionField("Description")
.DataSubTitleField("Subtitle")
.DataTitleField("Title")
.DataImagesField("Images")
.DataActionsField("Actions")
.Orientation("horizontal")
.DataSource(dt => dt.Read("GetTimelineData", "Timeline")) // see the first example in this article for a sample data source
)
<button onclick="buttonClick();">Go to next event</button>
<script>
function buttonClick() {
var timeline = $("#Timeline").data("kendoTimeline");
timeline.next();
}
</script>
Next Steps
- Getting Started with the Timeline
- Basic Usage of the Timeline for ASP.NET MVC (Demo)
- Timeline Events