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.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Syntax:

cs-api-definition
public class GridGroupByExpression : GroupDescriptor, INotifyPropertyChanged

Inheritance: objectGroupDescriptorGridGroupByExpression

Implements: INotifyPropertyChanged

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

Constructors

GridGroupByExpression()

Initializes a new instance of the GridGroupByExpression class.

Declaration

cs-api-definition
public GridGroupByExpression()

GridGroupByExpression(GridViewDataColumn)

Constructs a new GroupByExpression from a grid GridColumn.

Declaration

cs-api-definition
public GridGroupByExpression(GridViewDataColumn column)

Parameters

column

GridViewDataColumn

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:

GridGroupByExpression(string)

Initializes a new instance of the GridGroupByExpression class.

Declaration

cs-api-definition
public GridGroupByExpression(string expression)

Parameters

expression

string

The expression.

GridGroupByExpression(string, string)

Initializes a new instance of the GridGroupByExpression class.

Declaration

cs-api-definition
public GridGroupByExpression(string expression, string defaultFormatString)

Parameters

expression

string

The expression.

defaultFormatString

string

The default format string.

Fields

GroupByClause

Declaration

cs-api-definition
public const string GroupByClause = "Group By"

Field Value

string

Properties

DefaultFormatString

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

Declaration

cs-api-definition
public string DefaultFormatString { get; set; }

Property Value

string

Expression

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

Declaration

cs-api-definition
public override string Expression { get; set; }

Property Value

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

Example

csharp
Country, City, count(Country) Items, ContactName Group By Country, City desc
csharp
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

cs-api-definition
[Browsable(false)]
public GridGroupByFieldCollection GroupByFields { get; }

Property Value

GridGroupByFieldCollection

Index

Gets the index of the expression if added in a GridGroupByExpressionCollection

Declaration

cs-api-definition
[Browsable(false)]
public int Index { get; }

Property Value

int

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

cs-api-definition
[Browsable(false)]
public GridGroupByFieldCollection SelectFields { get; }

Property Value

GridGroupByFieldCollection

Methods

ContainsSameGroupByField(GridGroupByExpression)

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

Declaration

cs-api-definition
public bool ContainsSameGroupByField(GridGroupByExpression expression)

Parameters

expression

GridGroupByExpression

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

CopyFrom(GridGroupByExpression)

Copies from the passed GridGroupByExpression.

Declaration

cs-api-definition
public void CopyFrom(GridGroupByExpression expression)

Parameters

expression

GridGroupByExpression

The expression.

Equals(object)

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

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

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)

GetHashCode()

Serves as a hash function for a particular type.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

A hash code for the current object.

Overrides 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

cs-api-definition
public bool IsSame(GridGroupByExpression expression)

Parameters

expression

GridGroupByExpression

expression to check against this expression

Returns

bool

<strong>true</strong> if both expressions contain field with the same name,

otherwise false.

Parse(string)

Calls GridGroupByExpression(expression)

Declaration

cs-api-definition
public static GridGroupByExpression Parse(string expression)

Parameters

expression

string

Returns

GridGroupByExpression

ToString()

The same as the Expression property

Declaration

cs-api-definition
public override string ToString()

Returns

string

the string representation of the expression.

Overrides GroupDescriptor.ToString()