Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxPivotGridField.Field Property

Specifies the name of the database field that is assigned to the current object.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
[Parameter]
public string Field { get; set; }

#Property Value

Type Description
String

A String value that is the name of the data field.

#Remarks

Use the following syntax to connect a Pivot Grid field with a data source field:

Razor
<DxPivotGrid Data="@PivotGridData">
    <DxPivotGridField Field="@nameof(SaleInfo.City)" Area="PivotGridFieldArea.Row"></DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Date)" GroupInterval="PivotGridGroupInterval.Year" Area="PivotGridFieldArea.Column" Caption="Year"></DxPivotGridField>
    <DxPivotGridField Field="@nameof(SaleInfo.Amount)" Area="PivotGridFieldArea.Data" SummaryType="PivotGridSummaryType.Sum"></DxPivotGridField>
</DxPivotGrid>

You can also bind a Pivot Grid column to a complex field (a field that belongs to a data source object’s nested object). A complex field name is constructed via the DataSourceObject.Name1.Name2 structure. To bind a column to a complex field (CompanyName in the example below), use the following approach:

Razor
@{ var CompanyName = $"{nameof(Order.CompanyInfo)}.{nameof(Company.Name)}"; }

<DxPivotGrid Data="@Orders">
    <DxPivotGridField Field="@nameof(Order.ProductName)" Area="PivotGridFieldArea.Row"></DxPivotGridField>
    <DxPivotGridField Field="@CompanyName" Area="PivotGridFieldArea.Column"></DxPivotGridField>
    ...
</DxPivotGrid>

@code {

    IEnumerable<Order> Orders;

    public class Order {
        public int ID { get; set; }
        public string ProductName { get; set; }
        public Company CompanyInfo { get; set; } = new Company();
    }

    public class Company {
        public string Name { get; set; }
        public string Address { get; set; }
    }
}
See Also