Timeline in Razor Pages
Razor Pages is an alternative to the MVC pattern that makes page-focused coding easier and more productive. This approach consists of a cshtml
file and a cshtml.cs
file (by design, the two files have the same name).
You can seamlessly integrate the Telerik UI Timeline for ASP.NET Core in Razor Pages applications.
This article describes how to configure the Timeline component in a Razor Pages scenario.
For the complete project, refer to the Timeline in Razor Pages example.
Getting Started
To bind the Telerik UI Timeline to a data set within a RazorPage:
-
Setup the Read URL in the
DataSource
. The URL should refer the name of the method in thePageModel
..DataSource(dt => dt .Read(r=>r.Url("/Timeline/TimelineBinding?handler=Events")) )
<datasource> <transport> <read url="/Timeline/TimelineBinding?handler=Events" /> </transport> </datasource>
-
Within the
.cs
file, introduce ActionMethod to return the data set:public JsonResult OnGetEvents() { return new JsonResult(Events); }