Back to Devexpress

ASPxSummaryItemBase.DisplayFormat Property

aspnet-devexpress-dot-web-dot-aspxsummaryitembase-9a7d4a4d.md

latest4.9 KB
Original Source

ASPxSummaryItemBase.DisplayFormat Property

Gets or sets the pattern specifying the display format for the summary item.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
public virtual string DisplayFormat { get; set; }
vb
<DefaultValue("")>
Public Overridable Property DisplayFormat As String

Property Value

TypeDefaultDescription
StringString.Empty

A String value that specifies the format pattern.

|

Remarks

Use the DisplayFormat property to format the summary display text.

The summary pattern can include static text plus predefined indexed placeholders.

  • The {0} format item is the placeholder for the calculated summary value.

  • ASPX

aspx
<dx:ASPxSummaryItem FieldName="amount" ShowInGroupFooterColumn ="amount" SummaryType="Sum" DisplayFormat="My Caption: {0}"/>
  • The {1} format item is the placeholder for the caption of the column (row for ASPxVerticalGrid) whose values the current summary aggregates.

In the following example, if the “Price” column’s summary value is 100 , its formatted equivalent will be ‘Total of Price: $100.00’.

aspx
<dx:ASPxSummaryItem FieldName="amount" ShowInGroupFooterColumn ="amount" SummaryType="Sum" DisplayFormat="Total of {1}: {0:c2}"/>

The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayFormat 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.

asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/ReportHelper.cs#L72

csharp
label.Summary = new XRSummary() { Running = SummaryRunning.Group };
label.Summary.FormatString = item.DisplayFormat;
label.Summary.Func = GetSummaryFunc(item.SummaryType);

asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Models/MVCxGridViewState.cs#L91

csharp
ShowInColumn = item.ShowInColumn;
DisplayFormat = item.DisplayFormat;
SummaryType = item.SummaryType;

asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/ReportHelper.vb#L74

vb
label.Summary = New XRSummary() With {.Running = SummaryRunning.Group}
label.Summary.FormatString = item.DisplayFormat
label.Summary.Func = GetSummaryFunc(item.SummaryType)

asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Models/MVCxGridViewState.vb#L185

vb
ShowInColumn = item.ShowInColumn
DisplayFormat = item.DisplayFormat
SummaryType = item.SummaryType

See Also

Card View

Online Demo: Card View - Total Summary

Grid View

Online Demo: Grid - Grid Totals

Vertical Grid

Online Demo: Vertical Grid - Total Summary

ASPxSummaryItemBase Class

ASPxSummaryItemBase Members

DevExpress.Web Namespace