The requested page is not available for the requested platform. You are viewing the content for Default platform.
All docs
V19.2
19.2
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Bind To Data

  • 2 min to read

The Gantt control can operate only in bound mode. It supports standard data source types including SqlDataSource, ObjectDataSource, XmlDataSource, AccessDataSource, and SiteMapDataSource.

Data Source

The Gantt control requires a separate data source for each of the following objects:

See also: Gantt Control

Example:

<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

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)

    Mandatory fields for a task object:

    Field description

    Mapping

    Task's ID.

    ID

    A task's parent ID.

    ParentID

    A task's title.

    Title

    A task's start date.

    Start

    A task's end date.

    End

  • Dependency (Dependency)

    Mandatory fields for a dependency object:

    Field description

    Mapping

    A predecessor task's ID.

    PredecessorID

    A successor task's ID.

    SuccessorID

    A dependency type.

    DependencyType

    A dependency ID.

    ID

  • Resource (Resource)

    Mandatory fields for a resource object:

    Field description

    Mapping

    Task's resource ID.

    ID

    A task's resource name.

    Name

  • Resource Assignment (ResourceAssignment)

    Mandatory fields for a resource assignment object:

    Field description

    Mapping

    A task's resource assignment ID.

    ID

    A task's resource ID.

    ResourceID

    A task's ID.

    TaskID

Example:

<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 ID="ID" ParentID="ParentID" Title="Subject" Start="StartDate" End="EndDate" Progress="PercentComplete" />
        <Dependency ID="ID" PredecessorID="ParentID" SuccessorID="DependentID" DependencyType="Type" />
        <Resource ID="ID" Name="Name" />
        <ResourceAssignment ID="ID" TaskID="TaskID" ResourceID="TeamID" />
    </Mappings>
</dx:ASPxGantt>