DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » How To » Different duration bar color for different resources

Different duration bar color for different resources

Hello,

I need to show all the information or all the events related with different resources at the same time using the daypilot calendar control, so, in order to identify which events belong to an specific resource i need to assign a color per resource, which arises the next questions:

1. Is it possible to do this ?
2. How can I change the color of the event per resource?

Thanks in advanced

Agustin - 2/29/2008 7:00:16 PM
Place the resource in the DataTagFields and in the BeforeEventRender you can switch the e.Tag[0] en set the e.BackgroundColor to a desired color foreach resource
Lauwens - 3/3/2008 9:53:03 AM
Perhaps I wasn't that clear, and i see you wanted to change the DurationBar not the whole background color So here code example
protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e)
    {
        
        switch (e.Tag)
        {
            case 0:
                e.DurationBarColor = "yellow";
                break;
            case 1:
                e.DurationBarColor = "red";
                break;
            case 2:
                e.DurationBarColor = "green";
                break;
        }
    }
Lauwens - 3/3/2008 12:35:53 PM
Thanks
Agustin - 3/6/2008 10:45:20 PM
Lauwens, Thanks for posting the answer!
Dan Letecky - 3/10/2008 1:32:33 PM
Post reply