I’ve a Razor
Page project with Telerik ASP.NET Core Calender and a database in the back-end.
In the Calender I can create new schedules that saves to the database and also
read them to populate. For every schedule I would like to add what shift I should
be related to so I’ve added a resource and if I create it as a new list it
works fine but I can’t figure out how to populate from a table in the database.
It feels that I’ve tried million ways now without success.
In this way
it works:
.Resources(resource =>
{
resource.Add(m
=> m.ShiftID)
.Name("ShiftList")
.Title("Skift")
.DataTextField("Text")
.DataValueField("Value")
.DataColorField("Color")
.BindTo(new[] {
new { Text =
"fm-skift", Value = 1, Color = "#f8a398" } ,
new { Text =
"em-skift", Value = 2, Color = "#51a0ed" } ,
new { Text =
"Natt-skift", Value = 3, Color = "#56ca85" },
new { Text =
"FM-skift", Value = 4, Color = "#c39bd3" },
new { Text =
"EN-skift", Value = 5, Color = "#f1c40f" }
})
;
})
But how can
I populate from the database? All the Examples I can find are using MVC and not
“true” Razor Pages.
on the model page I've created a list from the database that contains, Value, Textand Color, but I can't use it with Telerik Resources.