Skip to main content
All docs
V19.1

GanttSettings.KeyFieldName Property

Gets or sets the name of the data source key field.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v19.1.dll

Declaration

public string KeyFieldName { get; set; }

Property Value

Type Description
String

Specifies the name of the data source key field.

Remarks

Since the Gantt is designed to display information in a tree structure, its data source should meet certain requirements. If a data source contains flat data, two additional fields are necessary to build a tree structure.

  • The first field must contain unique values. This field must be assigned to the KeyFieldName property.
  • The second field must contain key values of parent nodes for the current node. It should be assigned to the ParentFieldName property.

Note

The data types of the KeyFieldName and ParentFieldName fields must be the same.

@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.CallbackRouteValues = new { Controller = "Gantt", Action = "FeaturesPartial" };
    settings.Width = Unit.Percentage(100);

    settings.KeyFieldName = "ID";
    settings.ParentFieldName = "ParentID";
    ...
}).Bind(GanttDataProvider.Tasks, GanttDataProvider.Dependencies, GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments).GetHtml()

Online Demos

See Also