This topic provides an overview of grouping feature in WebGrid.
This topic contains the following sections:
- Enable Grouping
- Group Intervals
- Predefined Group Column
- Automatic Group Total Update
- Grouping Value List
- GroupRow Paging Support
Enable Grouping
To enable grouping in WebGrid, you only need to set the AllowGrouping property to Yes. Data can be grouped by right clicking on the column header and clicking on Group By This Field. Alternatively, you can drag the column and drop it in GroupBox. As default, GroupedColumn would be sorted in Ascending. You can also use Multiple group in this feature.
Group Intervals
The built-in Grouping capability in WebGrid has been one of its key successor, which automatically handles rows grouping based on specified Columns' value. The Enterprise edition extends this feature by allowing the grouping to be performed on different Group Interval, instead of the Column's Value. There are about 8 new Group Interval modes that you can apply to the GroupColumn such as Text, Alphabetical, Date, Month, ShortTime and so on. As always, you can apply these GroupIntervals visually in the designer and does not require you to write any codes in order to make it work. This greatly increases your application's value by delivering better grouping capability to end users while saving development time with its capability to use designer.
GroupIntervals | Description |
Value | The GroupRow will be grouped by GroupRow's value |
Text | The GroupRow will be grouped by GroupRow's text |
Alphabetical | The GroupRow will be grouped according Alphabetical order |
Date | The GroupRow will be grouped base on Date |
Month | The GroupRow will be grouped base on Month |
Year | The GroupRow will be grouped base on Year |
Hour | The GroupRow will be grouped base on Hour |
Minute | The GroupRow will be grouped base on Minute |
ShortTime | The GroupRow will be grouped base on ShortTime |
Quarterly | The GroupRow will be grouped base on Quarterly |
NamedPeriod | The GroupRow will be grouped base on NamedPeriod |
Another improvement to the grouping feature is the ability to customize the GroupMode and GroupRowFormatString of each level of group columns. The GroupMode enables you to specify which level of group column that will be expanded or collapsed initially, and the GroupRowFormatString allows you to specify different string formatting for each level of the group columns.
Here is a screenshot of the GroupInterval feature:
For further information, please read Walkthrough: Using Group Intervals in WebGrid.
Predefined Group Column
To set which column that you want to be grouped, you need to set in GroupedColumns property. Then, specify ColumnMember property. For more information, please read How-to: Group column initially.
Example | Copy Code |
---|---|
<RootTable> <GroupedColumns> <ISWebGrid:WebGridGroup ColumnMember="Country" GroupMode="Collapsed" SortOrder="Ascending" /> </GroupedColumns> </RootTable> |
There are others additional properties in GroupedColumns such as:
Property |
Explanation |
CaseSensitive |
Specify if the group column text is case sensitive or not |
GroupInterval |
Specify interval in group column |
GroupMode |
Specify the group mode in Collapsed or Expanded ( as default set as Collapsed) |
GroupRowValueFormatString |
Specify the string format for the group row’s value |
SortOrder |
Specify the sort order for the group column. (as default set as Ascending) |
Automatic Group Total Update
WebGrid is the first ASP.NET DataGrid that introduces rich data display features, such as grouping with built-in aggregation. In addition, WebGrid also allows developers to show GroupTotal in the data display. When enabled, every group will show a total row at the end of its group. This allows you to easily review the aggregate results of each column, per that group. For further information, please read (link Data Aggregation).
Grouping Value List
As explained in other topics, WebGrid also supports Valuelist. For grouping, normally it will group and show based its value (id). To have the valuelist result, simply set GroupInterval property as Text in WebGridColumn.
Example | Copy Code |
---|---|
<ISWebGrid:WebGridColumn Caption="CategoryID" DataMember="CategoryID" DataType="System.Int32" Name="CategoryID" Width="100px" GroupInterval="Text" UseValueListForSorting="Yes"> <ValueList DataMember="DefaultView" DataSourceID="AccessDataSource2" DataTextField="CategoryName" DataValueField="CategoryID"> </ValueList> </ISWebGrid:WebGridColumn> |
GroupRow Paging Support
WebGrid now supports group row paging when used together with VirtualLoad™ mode. The group row paging significantly improves overall performance by loading only a small number of records (specified in GroupRowPageSize property) when you expands the group header.
For more information, please read How-to: Enable Virtual Group Row Paging.
Getting Started
Getting Started
Overview
WebGrid Features Overview
Other Resources
Walkthrough Topics
How-to Topics