Expression similar to SQL's "Select Group By" clause that is used by GridTableView to group items (GroupByExpressions. Expressions can be defined by assigning Expression property and/or managing the items in SelectFields or GroupByFields collections.
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 GridGroupByException 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.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public class GridGroupByExpression : IStateManager
Inheritance: objectGridGroupByExpression
Implements:
Inherited Members
Constructors
public GridGroupByExpression()
Constructs a new GroupByExpression from a grid GridColumn.
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
public GridGroupByExpression(GridColumn column)
the column (and its DataField respectively) that will be used for grouping Telerik RadGrid
If the column does not have a valid GroupByExpression string assigned this constructor will throw GridGroupByException. Column should be Groupable The following properties will be copied from the corresponding column's properties:
Fields
public const string GroupByClause = "Group By"
Properties
String representation of the GroupBy expression.
public string Expression { get; set; }
Expression syntax:
fieldname[ alias]|aggregate(fieldname)[ alias][, ...] Group By fieldname[ sort][, ...]
- fieldname: the name of any field from the DataSource
- alias: alas 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 )
- sort: asc or desc - the sort order of the grouped items
GroupByFields
GridGroupByFieldList
Gets a collection of GridGroupByField objects that form the grouping clause. Standing on the right side of the "Group By" clause
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridGroupByFieldList GroupByFields { get; }
Gets the index of the expression if added in a GridGroupByExpressionCollection
[Browsable(false)]
public int Index { get; }
integer, representing the index of the collection ni GridGroupByExpressionCollection.
SelectFields
GridGroupByFieldList
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.
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public GridGroupByFieldList SelectFields { get; }
Methods
Checks if the given expression contains same Group-By field as this one.
public bool ContainsSameGroupByField(GridGroupByExpression expression)
Expression to check
Returns:true if the expression already contains this GroupByField, otherwise false.
Use this function to determine if two expressions seem to produce the same set of results
Copies the current GridGroupByExpression from another GridGroupByExpression.
public void CopyFrom(GridGroupByExpression expression)
The GridGroupByExpression to be coppied from.
Compares the current expression against the expression set as parameter and check if both expressions contain field with the same name.
public bool IsSame(GridGroupByExpression expression)
expression to check against this expression
Returns:true if both expressions contain field with the same name, otherwise false.
Calls GridGroupByExpression(expression)
The same as the Expression property
public override string ToString()
the string representation of the expression.
Overrides: