Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
     Summaries Overview
     Tutorial: Custom Summary Functions
     Tutorial: Format Summary Text
     Tutorial: Group Summaries
     Tutorial: Obtain Summary Values
     Tutorial: Sort Group Rows by Summary Values
     Tutorial: Total Summaries
     Total Summary
     Group Summary
     Custom Aggregate Functions
     Format Summary Values
     Obtain Summary Values
     Sorting Group Rows by Summary Values
     Controlling Visibility of Group Summaries for Individual Group Rows
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Format Summary Values

This topic describes the basics of summary formatting. The grid control supports 2 types of summaries: Total Summary and Group Summary. Summary values are calculated using standard aggregate functions: Sum, Min, Max, Avr and Count. In addition, Grid Control can perform custom summary calculations. See the Custom Aggregate Functions topic for details. The basic information about summaries is provided in the Summaries Overview topic.

Expanded Online Video

Learn how to add custom text to summary values, what kind of value formatting is applied to summaries by default and how to change summary value formatting.

Expanded Format Summary Values

The value of any summary type can be formatted via the GridSummaryItem.DisplayFormat property. The property value is set using a specifier whose structure is:

<custom static text>{0<:format specifier<precision specifier>>}<custom static text>

Accordingly, the simplest format that can be used for a summary item is {0}, which indicates that the format should simply be replaced with the value itself.

To demonstrate the formatting of summary values, the GridSummaryItem.DisplayFormat property is set to "Total {0} records" in the following example.

The following screenshot shows the results of the example.

When the format string is not specified for group summaries, default formats are used. The following table displays the default format of each summary type.

Summary Type Format
Average (AVR={0:#.##})
Count ({0})
Custom Custom format
Max (MAX={0})
Min (MIN={0})
Sum (SUM={0:#.##})

Format characters are used to represent various types of formatting, such as: currency, scientific, percent, and others. It is also possible to format date and time values. The precision specifier allows you to set the number of digits displayed after the decimal point for numeric values. It is represented by a number placed right after the format character. To learn more about format strings, refer to the Formatting Cell Values topic.

See the Formatting Types section of MSDN for complete information on formatting values.

Expanded See Also

How would you rate this topic?​​​​​​​