• Uses DayPilot ASP.NET MVC 5 Scheduler

  • Time on the horizontal axis

  • Resources (rooms, people, machines) on the vertical axis

  • Additional resource data in columns (Name, Id)

  • Clicking the column header sorts the resources

  • Visual Studio 2017 sample project

  • C# source code of the sample included

  • Includes a trial version of DayPilot Pro for ASP.NET MVC


Licensed for testing and evaluation purposes. You can use the source code of the tutorial if you are a licensed user of DayPilot Pro for ASP.NET MVC. Buy a license.

Scheduler Resource Header Columns

Create an ASP.NET MVC view with the scheduler. See also Scheduler for ASP.NET MVC tutorial for the setup instructions.

Define custom resource columns using HeaderColumns property:

@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig
    BackendUrl = Url.Content("~/Scheduler/Backend"),
    HeaderColumns = new RowHeaderColumnCollection {
        new RowHeaderColumn("Name", 80),
        new RowHeaderColumn("Id", 80)

Activating the Headers

Now we need to activate the column headers. We will modify the Column HTML to render a hyperlink with custom JavaScript action:

@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig
    BackendUrl = Url.Content("~/Scheduler/Backend"),
    HeaderColumns= new RowHeaderColumnCollection {
        new RowHeaderColumn("<a href='javascript:dps.commandCallBack(\"sort\", { field: \"name\" }); '>Name</a>", 80),
        new RowHeaderColumn("<a href='javascript:dps.commandCallBack(\"sort\", { field: \"id\" });'>Id</a>", 80)

Reloading the Resources

Clicking the column header will fire Command event on the server side with "sort" as the command name and the sort column available in e.Data["field"]. 

protected override void OnCommand(CommandArgs e)
  switch (e.Command)
    case "sort":

Full refresh is requested using Update(CallBackUpdateType.Full) call.

The LoadResources() method reloads the resources using the specified sort order:

private void LoadResources(string orderBy) {
  foreach (DataRow r in new EventManager().GetResources(orderBy).Rows)
      Resource res = new Resource((string)r["name"], Convert.ToString(r["id"]));
      res.DataItem = r;

Database Schema

Here is the database schema of the attached SQL Server database (daypilot.mdf):

CREATE TABLE [dbo].[event] (
    [id]         INT          IDENTITY (1, 1) NOT NULL,
    [name]       VARCHAR (50) NULL,
    [eventstart] DATETIME     NOT NULL,
    [eventend]   DATETIME     NOT NULL,
    [resource]   INT          NOT NULL,

CREATE TABLE [dbo].[resource] (
    [id]   INT          IDENTITY (1, 1) NOT NULL,
    [name] VARCHAR (50) NOT NULL