Tutorial: ASP.NET Scheduler Event Sorting

This tutorial shows how to use custom event sorting with the ASP.NET scheduler control. Sample Visual Studio solution with C# and VB source.
Aug 31, 2014
asp.net scheduler event sorting

Tutorial

Features

This tutorial shows how to enable custom event sorting inside ASP.NET scheduler time cells.

  • Custom event sorting using a dedicated database fields ("ordinal").
  • The event order can be updated by drag and drop to a new position.
  • Visual Studio 2012 Solution
  • C# and VB source code
  • Sample Microsoft SQL Server database (LocalDB)

Example

Sample configuration:

.aspx

<DayPilot:DayPilotScheduler 
  ID="Scheduler"
  runat="server"
  ...
  EventMoveToPosition="true"
/>

.aspx.cs

private void SetDataSourceAndBind(DateTime start, DateTime end)
{
  Scheduler.DataSource = GetData(start, end);

  Scheduler.DataStartField = "eventstart";
  Scheduler.DataEndField = "eventend";
  Scheduler.DataIdField = "id";
  Scheduler.DataTextField = "name";
  Scheduler.DataResourceField = "resource_id";

  Scheduler.EventSortExpression = "ordinal";

  Scheduler.DataBind();
}

The source code of the tutorial is available for download.