Scheduler: Custom Cell Rendering

The background cell appearance can be adjusted using BeforeCellRender event handler. 

1. Changing IsBusiness status

You can change the IsBusiness status using e.IsBusiness property. The cells will automatically use the color specified for business cell (BackColor) or non-business cells (NonBusinessBackColor).

Example

    protected void DayPilotScheduler1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.BeforeCellRenderEventArgs e)
    {
        if (e.Start.Hour == 13)
        {
            e.IsBusiness = false;
        }
    }

2. Changing the Color

You can also change the cell color directly using e.BackgroundColor.

Example

    protected void DayPilotScheduler1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.BeforeCellRenderEventArgs e)
    {
        if (e.ResourceId == "A")
        {
            e.BackgroundColor = "red";
        }
    }

3. Performance

If all cells in a column have the same color and this is true for all columns, the following optimization is applied:

  1. The color information is only sent once for each column. This makes the HTTP response size smaller.
  2. The column is rendered as a single div. This makes the rendering faster.

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java