Sample configuration and AJAX loading code:
.aspx
<DayPilot:DayPilotScheduler ... DynamicLoading="true" OnScroll="Scheduler_OnScroll" />
.aspx.cs
protected void Scheduler_OnScroll(object sender, ScrollEventArgs e) { SetDataSourceAndBind(Scheduler.ViewPort.Start, Scheduler.ViewPort.End); Scheduler.Update(); } 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.DataBind(); } private DataTable GetData(DateTime start, DateTime end) { SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [event] WHERE NOT (([eventend] <= @start) OR ([eventstart] >= @end))", ConfigurationManager.ConnectionStrings["daypilot"].ConnectionString); da.SelectCommand.Parameters.AddWithValue("start", start); da.SelectCommand.Parameters.AddWithValue("end", end); DataTable dt = new DataTable(); da.Fill(dt); return dt; }
The source code of the tutorial is available for download.