Class GridGroupByField
Field which is part of each SelectFields and GroupByFields collection
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.GridView.dll
Syntax
public class GridGroupByField : NotifyPropertyBase, INotifyPropertyChangingEx, INotifyPropertyChanged
Remarks
Some of the GridGroupByField properties are meaningful only when present under specific collection - SelectFields or GroupByFields
Examples
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"
groupExpression.GroupByFields.Add(groupByField)
RadGrid1.MasterTableView.GroupByExpressions.Add(groupExpression)
GridGroupByExpression groupExpression = new GridGroupByExpression();
GridGroupByField groupByField = new GridGroupByField();
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);
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
System.String
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.
Declaration
public GridGroupByField(string fieldName, Type dataType)
Parameters
System.String
fieldName
|
System.Type
dataType
|
Fields
aggregateResult
Declaration
protected object aggregateResult
Field Value
System.Object
|
DefaultFormatString
The default format string for the field.
Declaration
public static readonly string DefaultFormatString
Field Value
System.String
|
FieldDefaultFormatString
The default format string for the field.
Declaration
public static readonly string FieldDefaultFormatString
Field Value
System.String
|
Properties
Aggregate
Gets or sets aggregate function (from GridAggregateFunction enumeration values) that will be applied on the grouped data.
Declaration
public virtual GridAggregateFunction Aggregate { get; set; }
Property Value
GridAggregateFunction
Returns the result from currently used aggregate function. This property defaults to GridAggregateFunction.None |
Remarks
Meaningful only for fields in the SelectFields collection.
Examples
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
public virtual object DataSourceNullValue { get; set; }
Property Value
System.Object
|
DataType
Gets or sets the data type of the field.
Declaration
public virtual Type DataType { get; set; }
Property Value
System.Type
|
Expression
Gets or sets an expression for this field.
Declaration
public virtual string Expression { get; set; }
Property Value
System.String
|
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
public virtual string FieldAlias { get; set; }
Property Value
System.String
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:
Examples
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
public virtual string FieldName { get; set; }
Property Value
System.String
|
Filter
Gets or sets the instance of FilterExpression for this field.
Declaration
public virtual FilterExpression Filter { get; set; }
Property Value
FilterExpression
|
FormatString
Declaration
public string FormatString { get; set; }
Property Value
System.String
|
HeaderText
Gets or sets the expression that will be displayed in the GridGroupHeaderItem.
Declaration
public string HeaderText { get; set; }
Property Value
System.String
string, 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.
Examples
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
public virtual bool IsAggregate { get; }
Property Value
System.Boolean
|
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
public virtual bool IsFieldAliasSet { get; }
Property Value
System.Boolean
|
IsFormatStringSet
Gets a value indicating whether the FormatString is set.
Declaration
public virtual bool IsFormatStringSet { get; }
Property Value
System.Boolean
|
IsHeaderTextSet
Gets boolean value indicating whether HeaderText is set. When false, HeaderText will return FieldAlias
Declaration
public bool IsHeaderTextSet { get; }
Property Value
System.Boolean
|
NullValue
Gets or sets an object to be set as the control property when the data source contains a DBNull value.
Declaration
public virtual object NullValue { get; set; }
Property Value
System.Object
|
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
public virtual RadSortOrder SortOrder { get; set; }
Property Value
RadSortOrder
Returns the sorting mode applied to the grouped data. By default it is Ascending. |
Remarks
Meaningful only for fields in the GroupByFields collection.
Examples
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
GridGroupByField
field
|
GenerateFieldAlias()
Generates a string value representing the alias of the field based on the FieldName.
Declaration
protected string GenerateFieldAlias()
Returns
System.String
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
System.String
String containing the HeaderText value |
Remarks
Meaningful only for GridGroupByFields from the SelectFields collection
Examples
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
Declaration
public bool IsReferredAs(string name)
Parameters
System.String
name
The name that is to be checked against. |
Returns
System.Boolean
true if the current field can be referred as |
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
System.String
value
|
Remarks
Meaningful only for GridGroupByFields from the SelectFields collection
Examples
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
System.String
SortOrder
|
Remarks
Meaningful only for GridGroupByFields from the GroupByFields collection
Examples
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)
ToGroupByString()
Declaration
public string ToGroupByString()
Returns
System.String
|
ToGroupByString(Boolean)
Declaration
public string ToGroupByString(bool preferAlias)
Parameters
System.Boolean
preferAlias
|
Returns
System.String
|
ToSelectString()
Declaration
public string ToSelectString()
Returns
System.String
|
ToSelectString(String)
Converts to string considering the specific format.
Declaration
public string ToSelectString(string defaultFormatString)
Parameters
System.String
defaultFormatString
The default format string. |
Returns
System.String
|
ToString()
Method that retrieves a System.String that indicates the current object
Declaration
public override string ToString()
Returns
System.String
The string format of the object. |
Overrides
UpdateFormatString(Boolean, Boolean)
Declaration
public virtual string UpdateFormatString(bool doubleQuote, bool forceChange)
Parameters
System.Boolean
doubleQuote
|
System.Boolean
forceChange
|
Returns
System.String
|
UpdateFormatString(String, Boolean, Boolean)
Declaration
public static string UpdateFormatString(string formatString, bool doubleQuote, bool forceChange)
Parameters
System.String
formatString
|
System.Boolean
doubleQuote
|
System.Boolean
forceChange
|
Returns
System.String
|
Validate()
Inherited but not used
Declaration
public virtual void Validate()
ValidateFormatString()
Declaration
public virtual int ValidateFormatString()
Returns
System.Int32
|
ValidateFormatString(String)
Declaration
public static int ValidateFormatString(string formatString)
Parameters
System.String
formatString
|
Returns
System.Int32
|