Skip to main content
All docs
V24.1

DxTreeList.ParentKeyFieldName Property

Specifies the field that links a node to its parent.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
public string ParentKeyFieldName { get; set; }

Property Value

Type Default Description
String null

The name of the data field that stores parent node keys. This field’s value is 0 or null for root nodes.

Remarks

Assign a data source to the Data parameter to bind the TreeList component to data. To build a hierarchical structure of TreeList nodes, specify additional properties that define node relationships:

KeyFieldName
A field that contains unique identifiers for nodes.
ParentKeyFieldName
A field that contains parent node identifiers. This field’s value is 0 or null for root nodes.

To bind the TreeList component to the GridDevExtremeDataSource<T>, you should also specify the HasChildrenFieldName property. Refer to the following topic for more information: Bind Blazor TreeList to Data.

The following example binds the TreeList component to a flat data source and specifies node hierarchy settings:

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

Bind Blazor TreeList to Flat Data

Run Demo: Flat Data

Implements

See Also