DayPilot Knowledge Base

AJAX Calendar/Scheduling Controls
DayPilot Pro (AJAX Calendar Control)
» DayPilot AJAX Calendar
DayPilot Pro (AJAX Monthly Calendar Control)
» DayPilot AJAX Monthly Calendar
DayPilot Pro (AJAX Scheduler Control)
» DayPilot AJAX Scheduler
DayPilot » Knowledge Base » How to customize 'Week N' string in the Scheduler header

How to customize 'Week N' string in the Scheduler header

Last revision: Nov 1, 2012

The CellGroupBy = GroupByEnum.Week mode shows time columns grouped  by weeks. The first header column shows the week number: 

scheduler-week-number.png

You can customize this text using BeforeTimeHeaderRender event:

protected void DayPilotScheduler1_BeforeTimeHeaderRender(object sender, DayPilot.Web.Ui.Events.BeforeTimeHeaderRenderEventArgs e)
{
  if (e.IsColGroup)
  {
    e.InnerHTML = String.Format("W {0}", Week.WeekNrISO8601(e.Start));
  }
}

For multi-level time headers, you should check e.Level instead of e.IsColGroup:

protected void DayPilotScheduler1_BeforeTimeHeaderRender(object sender, DayPilot.Web.Ui.Events.BeforeTimeHeaderRenderEventArgs e)
{
  if (e.Level == 1)
  {
    e.InnerHTML = String.Format("W {0}", Week.WeekNrISO8601(e.Start));
  }
}

The Week.WeekNrISO8601() helper method calculates a week number from a given date. The ISO 8601 week numbering system assumes that week starts on Monday.

You can set the first day of week using WeekStarts property (specify the day of week or "Auto" for automatic detection using the current culture).

Related

How to add image to an event in DayPilot Month
How to set the time cell colors using database data in the Scheduler
How to show business hours on weekends in Scheduler
Events show HTML source during image export (PNG)