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

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.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Syntax:

C#
public class GridGroupByExpression : GroupDescriptor, INotifyPropertyChanged

Inheritance: objectGroupDescriptorGridGroupByExpression

Implements: INotifyPropertyChanged

Inherited Members GroupDescriptor.OnPropertyChanged(string)GroupDescriptor.OnPropertyChanged(PropertyChangedEventArgs)GroupDescriptor.AggregatesGroupDescriptor.FormatGroupDescriptor.GroupNamesGroupDescriptor.OwnerGroupDescriptor.PropertyChanged...

Constructors

Initializes a new instance of the GridGroupByExpression class.

C#
public GridGroupByExpression()

Constructs a new GroupByExpression from a grid GridColumn.

C#
public GridGroupByExpression(GridViewDataColumn column)
Parameters:columnGridViewDataColumn

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:

Initializes a new instance of the GridGroupByExpression class.

C#
public GridGroupByExpression(string expression, string defaultFormatString)
Parameters:expressionstring

The expression.

defaultFormatStringstring

The default format string.

Initializes a new instance of the GridGroupByExpression class.

C#
public GridGroupByExpression(string expression)
Parameters:expressionstring

The expression.

Fields

C#
public const string GroupByClause = "Group By"

Properties

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

C#
public string DefaultFormatString { get; set; }

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

C#
public override string Expression { get; set; }

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

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

C#
[Browsable(false)]
public GridGroupByFieldCollection GroupByFields { get; }

Gets the index of the expression if added in a GridGroupByExpressionCollection

C#
[Browsable(false)]
public int Index { get; }
Property Value:

integer, representing the index of the collection ni GridGroupByExpressionCollection.

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.

C#
[Browsable(false)]
public GridGroupByFieldCollection SelectFields { get; }

Methods

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

C#
public bool ContainsSameGroupByField(GridGroupByExpression expression)
Parameters:expressionGridGroupByExpression

Expression to check

Returns:

bool

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

Copies from the passed GridGroupByExpression.

C#
public void CopyFrom(GridGroupByExpression expression)
Parameters:expressionGridGroupByExpression

The expression.

Determines whether the specified object is equal to the current object.

C#
public override bool Equals(object obj)
Parameters:objobject

The object to compare with the current object.

Returns:

bool

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

Overrides: object.Equals(object)

Serves as a hash function for a particular type.

C#
public override int GetHashCode()
Returns:

int

A hash code for the current object.

Overrides: object.GetHashCode()

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

C#
public bool IsSame(GridGroupByExpression expression)
Parameters:expressionGridGroupByExpression

expression to check against this expression

Returns:

bool

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

Calls GridGroupByExpression(expression)

C#
public static GridGroupByExpression Parse(string expression)
Parameters:expressionstringReturns:

GridGroupByExpression

The same as the Expression property

C#
public override string ToString()
Returns:

string

the string representation of the expression.

Overrides: GroupDescriptor.ToString()