Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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
   [Collapse]Getting Started
    [Collapse]Walkthroughs
     [Expand]Appearance and Conditional Formatting
     [Expand]Data Editing
     [Expand]Hit Information
     [Expand]Data Binding and Working with Columns
     [Expand]Grid View - Columns, Rows and Cells
     [Expand]Banded Views
     [Expand]WinExplorer View
     [Expand]Tile View
     [Expand]Grouping
     [Expand]Filter and Search
     [Expand]Sorting
     [Collapse]Summaries
       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
     [Expand]Split Presentation
     [Expand]Row Preview Sections
   [Expand]Data Binding
   [Expand]Views
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [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]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Tutorial: Format Summary Text

This walkthrough is a transcript of the Format Summary Text video available on the DevExpress YouTube Channel.

In this tutorial, you will learn how to add custom text to summary values, what kind of value formatting is applied to summaries by default, how to change numeric value formatting using an example of a total summary, and how to change formatting for date-time values using an example of group summaries.

Expanded Starting Point

Start with a GridControl that has a footer enabled.

Expanded Adding Custom Text to Summary Values

Select a column and expand its GridColumn.SummaryItem property. Change the summary type to SummaryItemType.Count to see that the GridSummaryItem.DisplayFormat property is automatically changed to zero in curly braces ({0}). This indicates the value placeholder. Add the "Count" caption before the summary value.

Run the application. The footer cell under the Product Name column now shows the total record count along with the specified text.

Expanded Formatting Numeric Total Summary Value

Open the Property grid displaying the OrderSum column settings. Expand the GridColumn.SummaryItem property and set the summary type to SummaryItemType.Sum. The GridSummaryItem.DisplayFormat property is automatically changed. The created summary format string already contains custom text and the value placeholder additionally includes a format specifier - c2 – meaning currency formatting with two digits after the decimal point. Note that this format specifier matches the one specified by the column's GridColumn.DisplayFormat property. In other words, the summary value formatting matches cell value formatting.

Now change the format specifier to c0 to hide decimal digits.

To learn more about available numeric format specifiers, refer to the Standard Numeric Format Strings topic in MSDN.

Expanded Formatting Date-Time Group Summary Value

Close the application. To experiment with group summaries, invoke the Grid Designer, switch to the Group Summary Items Page and add a new item. Set the GridSummaryItem.FieldName property to OrderDate and the GridSummaryItem.SummaryType property to SummaryItemType.Max. The GridSummaryItem.DisplayFormat property is automatically changed. Note that summary text is enclosed in parentheses for group summaries to make them more readable when they follow each other in group rows. Now change the GridSummaryItem.DisplayFormat property to format values as a three-letter month string followed by a full year number.

See the Standard Date and Time Format Strings topic in MSDN for more information on date/time specifiers.

Run the application again. Group rows will now display summaries with custom-formatted dates.

Expanded See Also

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