aspnet-400740-components-gantt-bind-to-data.md
The Gantt control can operate only in bound mode. It supports standard data source types including SqlDataSource, ObjectDataSource, XmlDataSource, AccessDataSource, and SiteMapDataSource.
Run Demo: ASPxGantt - Data Binding and Editing
The Gantt control requires a separate data source for each of the following objects:
Note
Refer to the following topics to learn how to generate sample data for the Gantt (SQL script and C# code):
<dx:ASPxGantt ID="Gantt" runat="server" Width="100%" ClientInstanceName="clientGantt"
KeyFieldName="ID" ParentFieldName="ParentID"
TasksDataSourceID="TasksDataSource"
DependenciesDataSourceID="DependenciesDataSource"
ResourcesDataSourceID="ResourcesDataSource"
ResourceAssignmentsDataSourceID="ResourceAssignmentsDataSource">
...
</dx:ASPxGantt>
<asp:SqlDataSource ID="TasksDataSource" runat="server"
ConnectionString='<%$ ConnectionStrings:DevelopmentGanttConnectionString %>'
SelectCommand="SELECT * FROM [Tasks]" />
<asp:SqlDataSource ID="DependenciesDataSource" runat="server"
ConnectionString='<%$ ConnectionStrings:DevelopmentGanttConnectionString %>'
SelectCommand="SELECT * FROM [TaskDependecies]" />
<asp:SqlDataSource ID="ResourcesDataSource" runat="server"
ConnectionString='<%$ ConnectionStrings:DevelopmentGanttConnectionString %>'
SelectCommand="SELECT * FROM [Teams]" />
<asp:SqlDataSource ID="ResourceAssignmentsDataSource" runat="server"
ConnectionString='<%$ ConnectionStrings:DevelopmentGanttConnectionString %>'
SelectCommand="SELECT * FROM [TaskTeamRelations]" />
Mappings specify which field in a data source corresponds to an object’s property (task, dependency, resource).
The Gantt control requires mappings for the following objects:
Task (Task)
Dependency (Dependency)
Resource (Resource)
Resource Assignment (ResourceAssignment)
<dx:ASPxGantt ID="Gantt" runat="server" Width="100%" ClientInstanceName="clientGantt"
KeyFieldName="ID" ParentFieldName="ParentID"
TasksDataSourceID="TasksDataSource"
DependenciesDataSourceID="DependenciesDataSource"
ResourcesDataSourceID="ResourcesDataSource"
ResourceAssignmentsDataSourceID="ResourceAssignmentsDataSource">
<Columns>
...
</Columns>
<Mappings>
<Task Key="ID" ParentKey="ParentID" Title="Subject" Start="StartDate" End="EndDate" Progress="PercentComplete" Color="Color" />
<Dependency Key="ID" PredecessorKey="ParentID" SuccessorKey="DependentID" DependencyType="Type" />
<Resource Key="ID" Name="Name" Color="Color" />
<ResourceAssignment Key="ID" TaskKey="TaskID" ResourceKey="TeamID" />
</Mappings>
</dx:ASPxGantt>
See Also