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

CssClass property of BeforeCellRenderArgs doesn't work in some condition

Asked by DG
10 years ago.

Hi Dan,

I'm using MVC Scheduler control (pro - trial) on my page.

I'm trying to change the CssClass of a cell in the OnBeforeCellRender method based of some criteria.
This works well most of the times, but I noticed in one case, the cells are not rendered with the custom css class.

When any one of the cell in the current view has a different class than others, this works (different class for different cell, AND all the cells are rendered as separate divs).

But when the case is such that ALL the cells have the same CssClass for the current view, the class is not rendered at all; infact, the cells are not actually separate divs, instead only one div is rendered for the entire column, separated by horizontal lines.

I'm in the single day view.

// what i'm trying to do
protected override void OnBeforeCellRender(BeforeCellRenderArgs e)
var isAvailable = someMethodToGetCondition();

e.CssClass = isAvailable ? "my-scheduler-available" : "my-scheduler-unavailable";

To reiterate, during loading of the control, if some cells have different CssClass (because of above), things work good. But when every cell gets the same CssClass value, the class is not rendered, the cells are not rendered as separate divs.

The config I use is this:
Height = 180,
HeightSpec = HeightSpec.Fixed,
StartDate = DateTime.Now,
Days = 1,
CellDuration = 15
CellWidth = 25,
CellGroupBy = GroupBy.Hour,
ViewType = ViewType.Resources,
TimeFormat = TimeFormat.Clock12Hours,

Resources = GetDayPilotResourceCollection(),

CssOnly = true,
CssClassPrefix = "my-scheduler",

EventHeight = 25,
RowHeaderWidth = 120,
TreeEnabled = true,
ContextMenu = "menu",
EventBubble = "bubble",
Separators = new SeparatorCollection
new Separator(DateTime.Now, Color.Red)

Please let me know if you need to know anything else, or if I'm missing something.


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

This is a bug of the optimized rendering mode (all identical cells in a column are rendered as a single div). This is already fixed in the ASP.NET WebForms version and it will be fixed in the MVC version in the next build.

Comment posted by Dan Letecky [DayPilot]
10 years ago.

Please take a look at build 7.4.5587 in the sandbox:

This issue should be fixed now.

Comment posted by DG
10 years ago.

Thanks Dan, the bug looks fixed. :)

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