All docs
V19.2
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
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.

Gantt

  • 2 min to read

The Gantt (GanttExtension) visualizes the task flow.

DevExpress ASP.NET MVC Gantt - Getting Started

Features

  • Data-Bound Mode

    You should bind the Gantt to a data model that provides data for tasks. The Gantt supports standard data source types including SqlDataSource, ObjectDataSource, XmlDataSource, AccessDataSource, and SiteMapDataSource.

    See demo

  • Edit Tasks

    The Gantt supports the following edit operations:

    • Resize and modify tasks.

    • Modify resources.

    • Add and remove dependencies between tasks and assignments.

    • Edit cell values within the Task List region. The control saves changes on the server and updates the Gantt chart when cell values change.

    The Gantt stores changes made by end users and allows you to roll back the last change when necessary.

    See demo

  • View Types

    The Gantt allows you to switch between display styles (Ten Minutes, Thirty Minutes, Hours, Days, Weeks, and Months) to change the date intervals on the timescale.

    See demo

  • Scale Tasks

    You can browse data across various levels of detail. Hold the CTRL key and rotate your mouse's scroll wheel to zoom.

  • Change History

    The Gantt stores all changes made by users and allows them to roll back the changes when necessary.

  • Custom Work Time

    You can specify the work time, workdays, and holidays.

    See demo

  • Task title position

    The Gantt supports the following task title display styles: hidden, within tasks, and next to tasks.

    See demo

Add a Gantt to a View

Use the Gantt(GanttSettings) helper method to add the Gantt (GanttExtension) extension to a view. The Gantt(GanttSettings) method's parameter provides access to the Gantt's settings (GanttSettings).

View code (ASPX):

@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.KeyFieldName = "ID";
    settings.ParentFieldName = "ParentID";

    settings.Mappings.Task.Key = "ID";
    settings.Mappings.Task.ParentKey = "ParentID";
    //...

    settings.Columns.Add(c => {
        c.FieldName = "Subject";
        c.Width = 280;
    });
    settings.Columns.Add(c => {
        c.FieldName = "StartDate";
        c.Width = 100;
        c.DisplayFormat = "MM/dd/yyyy";
    });
    settings.Columns.Add(c => {
        c.FieldName = "EndDate";
        c.Width = 100;
        c.DisplayFormat = "MM/dd/yyyy";
    });

}).Bind(GanttDataProvider.Tasks, GanttDataProvider.Dependencies, GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments).Render()

View code (Razor):

@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.KeyFieldName = "ID";
    settings.ParentFieldName = "ParentID";

    settings.Mappings.Task.Key = "ID";
    settings.Mappings.Task.ParentKey = "ParentID";
    //...

    settings.Columns.Add(c => {
        c.FieldName = "Subject";
        c.Width = 280;
    });
    settings.Columns.Add(c => {
        c.FieldName = "StartDate";
        c.Width = 100;
        c.DisplayFormat = "MM/dd/yyyy";
    });
    settings.Columns.Add(c => {
        c.FieldName = "EndDate";
        c.Width = 100;
        c.DisplayFormat = "MM/dd/yyyy";
    });

}).Bind(GanttDataProvider.Tasks, GanttDataProvider.Dependencies, GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments).GetHtml()
NOTE

The Partial View should contain only the extension's code.

Visual Elements

Online Demos