Hi Scott,
The e.DataItem property is only initialized if you call DataBind(). Calling DataBind() is not necessary during callbacks/postbacks because the events are reloaded from the ViewState. However, there is no reference to the original objects in this case.
If you want to make the "color" field accessible during callbacks and postbacks without calling DataBind(), you need to load it to "tags":
<DayPilot:DayPilotScheduler
DataTagFields="color"
...
Then you'll be able to access the color field in BeforeEventRender:
protected void DayPilotScheduler1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Scheduler.BeforeEventRenderEventArgs e)
{
string color = e.Tag["color"];
if (!String.IsNullOrEmpty(color))
{
e.DurationBarColor = color;
}
}
Some more details can be found here:
https://doc.daypilot.org/scheduler/event-loading/