skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Forums
    • Videos
    • Blogs
    • Accessibility
    • Submit a Ticket

    Productivity and Design Tools

    • Visual Studio Extensions
    • Visual Studio Templates
    • Embedded Reporting
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class GridGroupByExpression

Expression similar to SQL's "Select Group By" clause that is used by GridTableView to group items . Expressions can be defined by assigning Expression property and/or managing the items in SelectFields or GroupByFields collections.

Inheritance
System.Object
GroupDescriptor
GridGroupByExpression
Inherited Members
GroupDescriptor.OnPropertyChanged(String)
GroupDescriptor.OnPropertyChanged(PropertyChangedEventArgs)
GroupDescriptor.Aggregates
GroupDescriptor.Format
GroupDescriptor.GroupNames
GroupDescriptor.Owner
GroupDescriptor.PropertyChanged
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.GridView.dll

Syntax

public class GridGroupByExpression : GroupDescriptor, INotifyPropertyChanged
Remarks

If you use Expression property to assign group by expression as string then the expression is parsed and SelectFields and GroupByFields are created. If the expression syntax is incorrect a System.FormatException would be thrown. You can use GridGroupByField's properties to set expression's fields appearance format strings, etc. See Expression property for details about the expression syntax.

Constructors

GridGroupByExpression()

Initializes a new instance of the GridGroupByExpression class.

Declaration
public GridGroupByExpression()

GridGroupByExpression(String)

Initializes a new instance of the GridGroupByExpression class.

Declaration
public GridGroupByExpression(string expression)
Parameters
System.String expression

The expression.

GridGroupByExpression(String, String)

Initializes a new instance of the GridGroupByExpression class.

Declaration
public GridGroupByExpression(string expression, string defaultFormatString)
Parameters
System.String expression

The expression.

System.String defaultFormatString

The default format string.

GridGroupByExpression(GridViewDataColumn)

Constructs a new GroupByExpression from a grid GridColumn.

Declaration
public GridGroupByExpression(GridViewDataColumn column)
Parameters
GridViewDataColumn column

the column (and its FieldName respectively) that will be used for grouping RadGridView

Remarks

The AllowGroup of the column should be true. The following properties will be copied from the corresponding column's properties:

Fields

GroupByClause

Declaration
public const string GroupByClause = "Group By"
Field Value
System.String

Properties

DefaultFormatString

Gets or Sets the format string that is applied to group expressions that have no explicitly specified format string.

Declaration
public string DefaultFormatString { get; set; }
Property Value
System.String

Expression

String representation of the GroupBy expression. See Remarks for details.

Declaration
public override string Expression { get; set; }
Property Value
System.String

Overrides
GroupDescriptor.Expression
Remarks

Create group-by expressions, using the following expression syntax:
fieldname[ as alias] [format "..."]|aggregate(fieldname|alias)[as alias][, ...] Group By fieldname|alias [ASC|DESC]
Where:
fieldname
: name of any field from the DataSource
alias
: alias string. This cannot contain blanks or other reserved symbols like ',', '.' etc.
aggregate
: any of - min, max, sum, count, last, first etc (the same as in GridAggregateFunction enumeration)
format
string identical to the one used with string.Format, where the first argument is the field name or the alias and the second one is the actual value. The default value is "{0}: {1}"
Example: Country, City, count(Country) Items, ContactName Group By Country, City desc

Examples
Country, City, count(Country) Items, ContactName Group By Country, City desc
Country, City, count(Country) Items, ContactName Group By Country, City desc

GroupByFields

Gets a collection of GridGroupByField objects that form the grouping clause. Standing on the right side of the "Group By" clause

Declaration
public GridGroupByFieldCollection GroupByFields { get; }
Property Value
GridGroupByFieldCollection

Index

Gets the index of the expression if added in a GridGroupByExpressionCollection

Declaration
public int Index { get; }
Property Value
System.Int32

integer, representing the index of the collection ni GridGroupByExpressionCollection.

SelectFields

Gets a collection of SelectField objects (field names, aggregates etc.) that form the "Select" clause. Standing on the left side of the "Group By" clause.

Declaration
public GridGroupByFieldCollection SelectFields { get; }
Property Value
GridGroupByFieldCollection

Methods

ContainsSameGroupByField(GridGroupByExpression)

Checks if the given expression contains same Group-By field as this one.

Declaration
public bool ContainsSameGroupByField(GridGroupByExpression expression)
Parameters
GridGroupByExpression expression

Expression to check

Returns
System.Boolean

true if the expression already contains this GroupByField, otherwise false.

Remarks

Use this function to determine if two expressions seem to produce the same set of results

CopyFrom(GridGroupByExpression)

Copies from the passed GridGroupByExpression.

Declaration
public void CopyFrom(GridGroupByExpression expression)
Parameters
GridGroupByExpression expression

The expression.

Equals(Object)

Determines whether the specified System.Object is equal to the current System.Object.

Declaration
public override bool Equals(object obj)
Parameters
System.Object obj

The object to compare with the current object.

Returns
System.Boolean

true if the specified System.Object is equal to the current System.Object; otherwise, false.

Overrides
System.Object.Equals(System.Object)

GetHashCode()

Serves as a hash function for a particular type.

Declaration
public override int GetHashCode()
Returns
System.Int32

A hash code for the current System.Object.

Overrides
System.Object.GetHashCode()

IsSame(GridGroupByExpression)

Compares the current expression against the expression set as parameter and check if both expressions contain field with the same name.

Declaration
public bool IsSame(GridGroupByExpression expression)
Parameters
GridGroupByExpression expression

expression to check against this expression

Returns
System.Boolean

true if both expressions contain field with the same name, otherwise false.

Parse(String)

Calls GridGroupByExpression(expression)

Declaration
public static GridGroupByExpression Parse(string expression)
Parameters
System.String expression

Returns
GridGroupByExpression

ToString()

The same as the Expression property

Declaration
public override string ToString()
Returns
System.String

the string representation of the expression.

Overrides
GroupDescriptor.ToString()

Extension Methods

SvgExtentions.Traverse<T>(T, Func<T, IEnumerable<T>>)
SvgExtentions.TraverseDepthFirst<T>(T, Func<T, IEnumerable<T>>)
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.