Server-side Programming Overview
You can configure the settings of RadTimeline and create its elements in the code-behind via the Server-Side API of the control.
RadTimeline Server-side Events
Below you can see a list of the server-side events available in the RadTimeline:
- OnDataBinding
- OnDataBound
- OnInit
- OnItemDataBound
- OnLoad
- OnPreRender
RadTimeline Public Properties and Methods
For a list with the server-side properties and methods of the control, see the Server-Side API of the RadTimeline class. You can also find it in the intellisense in Visual Studio.
Create RadTimeline Dynamically
In this sample you will see how to create a collection of TimelineItem
objects in RadTimeline. The TimelineItem
exposes Title
, Subtitle
, Date
and Description
properties and gives ability to define separate TimelineItemImage
and TimelineItemAction
objects specific for each item.
protected void Page_Load(object sender, EventArgs e)
{
RadTimeline timeline = new RadTimeline();
for (int i = 0; i < 4; i++)
{
var timelineEvent = new TimelineItem()
{
Title = "Title #" + (i + 1),
Subtitle = "my subtitle",
Date = DateTime.Now.AddDays(i),
Description = "event description here",
};
timelineEvent.Images.Add(new TimelineItemImage() { Src = "https://via.placeholder.com/64" });
timelineEvent.Actions.Add(new TimelineItemAction() { Text = "text", Url = "https://via.placeholder.com/64" });
timeline.Items.Add(timelineEvent);
Page.Form.Controls.Add(timeline);
}
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim timeline As RadTimeline = New RadTimeline()
For i As Integer = 0 To 4 - 1
Dim timelineEvent = New TimelineItem() With {
.Title = "Title #" & (i + 1),
.Subtitle = "my subtitle",
.Date = DateTime.Now.AddDays(i),
.Description = "event description here"
}
timelineEvent.Images.Add(New TimelineItemImage() With {
.Src = "https://via.placeholder.com/64"
})
timelineEvent.Actions.Add(New TimelineItemAction() With {
.Text = "text",
.Url = "https://via.placeholder.com/64"
})
timeline.Items.Add(timelineEvent)
Page.Form.Controls.Add(timeline)
Next
End Sub