New to Telerik UI for WinFormsStart a free 30-day trial

How to Save/Load GridView's Layout with Custom Summary Items

Updated over 6 months ago

Environment

Product VersionProductAuthor
2020.3.1020RadGridView for WinFormsDesislava Yordanova

Description

RadGridView provides a convenient API for creating summary rows. If the default aggregate functions are not suitable for your case, you can write your own logic for summary items evaluation by inheriting the GridViewSummaryItem class and overriding the Evaluate method. A common requirement is to save the layout and load it at a later moment. However, the custom defined summary item may not be properly restored and it will stop functioning properly.

Solution

In order to save the custom summary row in the layout and restore it as expected at a later moment, it is necessary to meet two requirements:

  1. Have a parameterless constructor for the custom GridViewSummaryItem.
  2. The custom GridViewSummaryItem class must be defined outside the form's class. It is good to create a separate file for the class.

See Also