search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Event Background color

Asked by Imen Jaber
8 years ago.

I have to color each event with its proper backgroud color which is saved on the database ,
NB: i applied a css mode : CssOnly="True" cssclassprefix="month_white"
on the event BeforeEventRender where i can change the color i tried to change it by :
foreach (Event e in events)
e.BackgroundColor = e.Color;

The color still unchanging

Answer posted by Dan Letecky [DayPilot]
8 years ago.

The code for setting custom event background color should look like this:

protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
      e.BackgroundColor = (string)e.DataItem["color"];

This assumes your data source has the color string stored in a "color" field.

See also:

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.