Back to Devexpress

PivotGridField.FieldName Property

aspnet-devexpress-dot-web-dot-aspxpivotgrid-dot-pivotgridfield-0539941f.md

latest4.2 KB
Original Source

PivotGridField.FieldName Property

Gets or sets the name of the database field that is assigned to the current PivotGridField object.

Namespace : DevExpress.Web.ASPxPivotGrid

Assembly : DevExpress.Web.ASPxPivotGrid.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
[PivotAPIMemberCategory(APICategory.LegacyBinding)]
public string FieldName { get; set; }
vb
<PivotAPIMemberCategory(APICategory.LegacyBinding)>
<DefaultValue("")>
Public Property FieldName As String

Property Value

TypeDefaultDescription
StringString.Empty

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

|

Remarks

Note

This member is not supported in Optimized, OLAP, and Server modes. Use DataSourceColumnBindingBase.ColumnName instead.

Use this property to change the data field that is assigned to the current PivotGridField object. To specify the text displayed within the field’s header, use the PivotGridFieldBase.Caption property.

In OLAP binding mode, the FieldName property must specify the full name of the bound measure or dimension.

For dimensions, the full name is composed of a dimension’s name, followed by a hierachy’s name, followed by the name of a level(s). All names should be wrapped within square brackets and separated from one another using the dot symbol. Example: “[Customer].[Customer Geography].[Country]”.

For measures, the full name is composed of the “[Measures].” string followed by the measure’s name. Example: “[Measures].[Sales Amount]”.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FieldName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

web-forms-pivot-grid-add-unbound-fields/CS/ASPxPivotGrid_CalculateUnboundData/Default.aspx.cs#L10

csharp
protected void CustomUnboundFieldData(object sender, CustomFieldDataEventArgs e) {
    if (e.Field.FieldName != "PriceWithDiscount") return;
    decimal extPrice = Convert.ToDecimal(e.GetListSourceColumnValue("ExtendedPrice"));

web-forms-pivot-grid-add-unbound-fields/VB/ASPxPivotGrid_CalculateUnboundData/Default.aspx.vb#L14

vb
Protected Sub CustomUnboundFieldData(ByVal sender As Object, ByVal e As CustomFieldDataEventArgs)
    If Not Equals(e.Field.FieldName, "PriceWithDiscount") Then Return
    Dim extPrice As Decimal = Convert.ToDecimal(e.GetListSourceColumnValue("ExtendedPrice"))

See Also

PivotGridField Class

PivotGridField Members

DevExpress.Web.ASPxPivotGrid Namespace