In ASP.NET WebForms, you can indeed use the BeforeCellRender
event.
You just need to check whether the current cell falls on one of the defined holidays.
Example:
// Define an array of holidays
private static readonly DateTime[] Holidays = new DateTime[]
{
new DateTime(2024, 12, 25), // Christmas
new DateTime(2024, 1, 1), // New Year's Day
new DateTime(2024, 7, 4), // Independence Day
// Add more holidays as needed
};
protected void DayPilotScheduler1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.BeforeCellRenderEventArgs e)
{
if (Holidays.Contains(e.Start.Date))
{
e.BackgroundColor = "#f8f8f8"; // Example color for holidays
}
}