New to Telerik UI for ASP.NET MVC? Start a free 30-day trial
Templates
The Timeline lets you define your own template for rendering the events data, so you can customize it to your needs instead of using the default card.
You can find a live example in the Templates demo of the Timeline.
The following example shows how you can customize the template of the timeline - to show more than one image and how you can use custom fields from your model that would not be recognized by the default template. The classes and HTML structure in this example mimic the default card template (except the custom field).
Razor
@(Html.Kendo().Timeline<Kendo.Mvc.Examples.Models.TimelineEventModel>()
.Name("Timeline")
.EventTemplateId("eventTemplate")
.Orientation("horizontal")
.Dateformat("MMMM yyyy")
.DataDateField("EventDate")
.DataDescriptionField("Description")
.DataSubTitleField("Subtitle")
.DataTitleField("Title")
.DataImagesField("Images")
.DataActionsField("Actions")
.DataSource(dt => dt.Read("GetTimelineData", "Timeline"))
)
<script id="eventTemplate" type="text/x-kendo-template">
<div class="k-card-header">
<h5 class="k-card-title">#= data.Title #</h5>
<h6 class="k-card-subtitle"><strong>#= kendo.toString(data.EventDate, "MMM d, yyyy")#</strong></h6>
</div>
<div class="k-card-body">
<div class="k-card-description">
<p>#= data.Description #</p>
<div class="imageContainer">
# for (var i = 0; i < data.Images.length; i++) { #
<img src="#= data.Images[i].src #" class="k-card-media">
# } #
</div>
</div>
</div>
<p>I was with #=data.Friends#</p>
<div class="k-actions k-card-actions">
<a class="k-button k-flat k-primary" href="#= data.Actions[0].url #" target="_blank">#= data.Actions[0].text #</a>
</div>
</script>