DayPilot Lite for ASP.NET WebForms 3.1 [open-source, Apache Software License 2.0] now supports custom calendar event colors in the Calendar control.
Using BeforeEventRender event, it is possible to set custom event properties:
protected void DayPilotCalendar1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.BeforeEventRenderEventArgs e)
{
if (e.Value == "1")
{
e.DurationBarColor = "red";
}
}You can access the source object (passed to the Calendar in the DataSource collection) using e.DataItem property:
protected void DayPilotCalendar1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.BeforeEventRenderEventArgs e)
{
string color = e.DataItem["color"] as string;
if (!String.IsNullOrEmpty(color))
{
e.DurationBarColor = color;
}
}This way it is possible to load the event color or type directly from the database.