ClassGridGroupByField
Field which is part of each SelectFields and GroupByFields collection
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.GridView.dll
Syntax:
public class GridGroupByField : NotifyPropertyBase, INotifyPropertyChangingEx, INotifyPropertyChanged
Inheritance: objectNotifyPropertyBaseGridGroupByField
Implements:
Inherited Members
Constructors
GridGroupByField()
Initializes a new instance of the GridGroupByField class.
Declaration
public GridGroupByField()
GridGroupByField(string)
Initializes a new instance of the GridGroupByField class with a name of a field.
Declaration
public GridGroupByField(string fieldName)
Parameters
fieldName
The name of a field from the data source.
GridGroupByField(string, Type)
Initializes a new instance of the GridGroupByField class with a name of a field and its data type.
Fields
DefaultFormatString
The default format string for the field.
FieldDefaultFormatString
The default format string for the field.
Declaration
public static readonly string FieldDefaultFormatString
Field Value
Properties
Aggregate
Gets or sets aggregate function (from GridAggregateFunction enumeration values) that will be applied on the grouped data.
Declaration
[Browsable(true)]
public virtual GridAggregateFunction Aggregate { get; set; }
Property Value
Returns the result from currently used aggregate function. This property defaults to GridAggregateFunction.None
Remarks
Meaningful only for fields in the SelectFields collection.
Example
GridGroupByField gridGroupByField;
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "Freight";
gridGroupByField.HeaderText = "Total shipping cost is ";
gridGroupByField.Aggregate = GridAggregateFunction.Sum;
expression.SelectFields.Add( gridGroupByField );
Dim gridGroupByField As GridGroupByField
gridGroupByField = New GridGroupByField
gridGroupByField.FieldName = "Freight"
gridGroupByField.HeaderText = "Total shipping cost is "
gridGroupByField.Aggregate = GridAggregateFunction.Sum
expression.SelectFields.Add(gridGroupByField)
DataSourceNullValue
Gets or sets a value to be stored in the data source if the control value is null or empty.
Declaration
[Browsable(false)]
public virtual object DataSourceNullValue { get; set; }
Property Value
DataType
Gets or sets the data type of the field.
Declaration
[Browsable(false)]
public virtual Type DataType { get; set; }
Property Value
Expression
Gets or sets an expression for this field.
FieldAlias
Gets or sets a value representing a friendly name for the field used for forming the group by expression. This name will be displayed in each group header when grouping by the respective field.
Declaration
[Browsable(true)]
public virtual string FieldAlias { get; set; }
Property Value
String representing the friendly name shown
Remarks
Use this property for setting the field text that will be displayed in the GridGroupHeaderItem. If this property is not set, the value of FieldName property will be used. Note that this property has a meaning only for GridGroupByField part of the SelectFields of GridGroupByExpression.
This property is useful in cases when:
- you want to change the value displayed in group header (different than
the default FieldName column value)
or - group by a template column and RadGridView cannot get the header text for that column.
Example
GridGroupByField gridGroupByField;
//Add select fields (before the "Group By" clause)
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "EmployeeID";
gridGroupByField.FieldAlias = "EmployeeIdentificator";
expression.SelectFields.Add( gridGroupByField );
Dim gridGroupByField As GridGroupByField
'Add select fields (before the "Group By" clause)
gridGroupByField = New GridGroupByField
gridGroupByField.FieldName = "EmployeeID"
gridGroupByField.FieldAlias = "EmployeeIdentificator"
expression.SelectFields.Add(gridGroupByField)
FieldName
Gets or sets the name data source property or database column from a data source.
Declaration
[Browsable(true)]
public virtual string FieldName { get; set; }
Property Value
Filter
Gets or sets the instance of FilterExpression for this field.
Declaration
public virtual FilterExpression Filter { get; set; }
Property Value
HeaderText
Gets or sets the expression that will be displayed in the GridGroupHeaderItem.
Declaration
public string HeaderText { get; set; }
Property Value
<strong>string</strong>, copied from the column's HeaderText if this group
expression is based on a column. It defaults to the FieldAlias value (if specified).
Remarks
Meaningful only for fields in the SelectFields collection. When rendering RadGrid will override the FieldAlias value with the HeaderText specified.
Example
GridGroupByField gridGroupByField;
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "EmployeeID";
gridGroupByField.HeaderText = "EmployeeNo";
expression.SelectFields.Add( gridGroupByField );
Dim gridGroupByField As GridGroupByField
gridGroupByField = New GridGroupByField
gridGroupByField.FieldName = "EmployeeID"
gridGroupByField.HeaderText = "EmployeeNo"
expression.SelectFields.Add(gridGroupByField)
IsAggregate
Gets boolean value indicating whether the current GridGroupByField is an aggregate.
Declaration
[Browsable(false)]
public virtual bool IsAggregate { get; }
Property Value
IsFieldAliasSet
Gets boolean value indicating whether FieldAlias is set. When false, FieldAlias will return 'Aggregate of FieldName' if the current group-by field is an aggregate, 'FieldName' otherwise.
Declaration
[Browsable(false)]
public virtual bool IsFieldAliasSet { get; }
Property Value
IsFormatStringSet
Gets a value indicating whether the FormatString is set.
Declaration
[Browsable(false)]
public virtual bool IsFormatStringSet { get; }
Property Value
IsHeaderTextSet
Gets boolean value indicating whether HeaderText is set. When false, HeaderText will return FieldAlias
Declaration
[Browsable(false)]
public bool IsHeaderTextSet { get; }
Property Value
NullValue
Gets or sets an object to be set as the control property when the data source contains a DBNull value.
Declaration
[Browsable(false)]
public virtual object NullValue { get; set; }
Property Value
SortOrder
Gets or sets the value indicating how the data will be sorted. Acceptable values are the values of RadSortOrder enumeration (Ascending, Descending and None).
Declaration
[Browsable(true)]
public virtual RadSortOrder SortOrder { get; set; }
Property Value
Returns the sorting mode applied to the grouped data. By default it is Ascending.
Remarks
Meaningful only for fields in the GroupByFields collection.
Example
GridGroupByField gridGroupByField;
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "EmployeeID";
gridGroupByField.SortOrder = GridSortOrder.Descending;
expression.GroupByFields.Add( gridGroupByField );
Dim gridGroupByField As GridGroupByField
gridGroupByField = New GridGroupByField
gridGroupByField.FieldName = "EmployeeID"
gridGroupByField.SortOrder = GridSortOrder.Descending
expression.GroupByFields.Add(gridGroupByField)
Methods
CopyFrom(GridGroupByField)
Inherited but not used
Declaration
public void CopyFrom(GridGroupByField field)
Parameters
field
GenerateFieldAlias()
Generates a string value representing the alias of the field based on the FieldName.
Declaration
protected string GenerateFieldAlias()
Returns
A string value representing the alias of the field.
GetHeaderText()
Method which gets the HeaderText value from GridGroupByField part of the SelectFields collection
Declaration
public string GetHeaderText()
Returns
String containing the HeaderText value
Remarks
Meaningful only for GridGroupByFields from the SelectFields collection
Example
Dim groupExpression As GridGroupByExpression = RadGrid1.MasterTableView.GroupByExpressions(0)
Dim headerText as String = groupExpression.SelectFields(0).GetHeaderText()
GridGroupByExpression groupExpression = RadGrid1.MasterTableView.GroupByExpressions[0] as GridGroupByExpression;
String headerText = groupExpression.SelectFields[0].GetHeaderText()
IsReferredAs(string)
Each GridGroupByField can be referenced using FieldName and FieldAlias
This method checks whether the current GridGroupByField's FieldName or FieldAlias
match the given name
ResetFieldAliasCache()
Declaration
protected void ResetFieldAliasCache()
SetAggregate(string)
Method setting the aggregate function applied for a GridGroupByField which is part of the SelectFields collection.
Declaration
public virtual void SetAggregate(string value)
Parameters
value
Remarks
Meaningful only for GridGroupByFields from the SelectFields collection
Example
Dim groupExpression As GridGroupByExpression = New GridGroupByExpression()
Dim groupByField As GridGroupByField = New GridGroupByField()
groupByField.FieldName = "Size"
groupByField.SetAggregate(GridAggregateFunction.Sum)
groupExpression.SelectFields.Add(groupByField)
groupByField = New GridGroupByField()
groupByField.FieldName = "Received"
groupExpression.SelectFields.Add(groupByField)
groupByField = New GridGroupByField()
groupByField.FieldName = "Received"
groupExpression.GroupByFields.Add(groupByField)
RadGrid1.MasterTableView.GroupByExpressions.Add(groupExpression)
GridGroupByExpression groupExpression = new GridGroupByExpression();
GridGroupByField groupByField = new GridGroupByField();
groupByField.FieldName = "Size";
groupByField.SetAggregate(GridAggregateFunction.Sum);
groupExpression.SelectFields.Add(groupByField);
groupByField = new GridGroupByField();
groupByField.FieldName = "Received";
groupExpression.SelectFields.Add(groupByField);
groupByField = new GridGroupByField();
groupByField.FieldName = "Received";
groupExpression.GroupByFields.Add(groupByField);
RadGrid1.MasterTableView.GroupByExpressions.Add(groupExpression);
SetSortOrder(string)
Method setting the sort order applied for a GridGroupByField which is part of the GroupByFields collection.
Declaration
public void SetSortOrder(string SortOrder)
Parameters
SortOrder
Remarks
Meaningful only for GridGroupByFields from the GroupByFields collection
Example
GridGroupByExpression groupExpression = new GridGroupByExpression();
groupByField = new GridGroupByField();
groupByField.FieldName = "Received";
groupExpression.SelectFields.Add(groupByField);
groupByField = new GridGroupByField();
groupByField.FieldName = "Received";
groupByField.SetSortOrder(GridSortOrder.Ascending);
groupExpression.GroupByFields.Add(groupByField);
RadGrid1.MasterTableView.GroupByExpressions.Add(groupExpression);
Dim groupExpression As GridGroupByExpression = New GridGroupByExpression()
Dim groupByField As GridGroupByField = New GridGroupByField()
groupByField = New GridGroupByField()
groupByField.FieldName = "Received"
groupExpression.SelectFields.Add(groupByField)
groupByField = New GridGroupByField()
groupByField.FieldName = "Received"
groupByField.SetSortOrder(GridSortOrder.Descending)
groupExpression.GroupByFields.Add(groupByField)
RadGrid1.MasterTableView.GroupByExpressions.Add(groupExpression)
ToSelectString(string)
Converts to string considering the specific format.
ToString()
Method that retrieves a System.String that indicates the current object
Declaration
public override string ToString()
Returns
The string format of the object.
Overrides