Class
GridGroupByField

Field which is part of each SelectFields and GroupByFields collection

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.GridView.dll

Syntax:

cs-api-definition
public class GridGroupByField : NotifyPropertyBase, INotifyPropertyChangingEx, INotifyPropertyChanged

Inheritance: objectNotifyPropertyBaseGridGroupByField

Implements: INotifyPropertyChangedINotifyPropertyChangingEx

Inherited Members NotifyPropertyBase.SuspendNotifications()NotifyPropertyBase.ResumeNotifications(bool)NotifyPropertyBase.ResumeNotifications()NotifyPropertyBase.OnPropertyChanged(string)NotifyPropertyBase.OnPropertyChanged(PropertyChangedEventArgs)NotifyPropertyBase.ProcessPropertyChanged(PropertyChangedEventArgs)NotifyPropertyBase.OnPropertyChanging(string, object, object)NotifyPropertyBase.OnPropertyChanging(string)NotifyPropertyBase.OnPropertyChanging(PropertyChangingEventArgsEx)NotifyPropertyBase.ProcessPropertyChanging(PropertyChangingEventArgsEx)NotifyPropertyBase.SetProperty<T>(string, ref T, T)NotifyPropertyBase.IsSuspendedNotifyPropertyBase.PropertyChangedNotifyPropertyBase.PropertyChanging

Constructors

GridGroupByField()

Initializes a new instance of the GridGroupByField class.

Declaration

cs-api-definition
public GridGroupByField()

GridGroupByField(string)

Initializes a new instance of the GridGroupByField class with a name of a field.

Declaration

cs-api-definition
public GridGroupByField(string fieldName)

Parameters

fieldName

string

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

cs-api-definition
public GridGroupByField(string fieldName, Type dataType)

Parameters

fieldName

string

dataType

Type

Fields

DefaultFormatString

The default format string for the field.

Declaration

cs-api-definition
public static readonly string DefaultFormatString

Field Value

string

FieldDefaultFormatString

The default format string for the field.

Declaration

cs-api-definition
public static readonly string FieldDefaultFormatString

Field Value

string

aggregateResult

Declaration

cs-api-definition
protected object aggregateResult

Field Value

object

Properties

Aggregate

Gets or sets aggregate function (from GridAggregateFunction enumeration values) that will be applied on the grouped data.

Declaration

cs-api-definition
[Browsable(true)]
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.

Example

csharp
GridGroupByField gridGroupByField;

gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "Freight";
gridGroupByField.HeaderText = "Total shipping cost is ";
gridGroupByField.Aggregate = GridAggregateFunction.Sum;
expression.SelectFields.Add( gridGroupByField );
csharp
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

cs-api-definition
[Browsable(false)]
public virtual object DataSourceNullValue { get; set; }

Property Value

object

DataType

Gets or sets the data type of the field.

Declaration

cs-api-definition
[Browsable(false)]
public virtual Type DataType { get; set; }

Property Value

Type

Expression

Gets or sets an expression for this field.

Declaration

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

Property Value

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

cs-api-definition
[Browsable(true)]
public virtual string FieldAlias { get; set; }

Property Value

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:

  • 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

csharp
GridGroupByField gridGroupByField;

//Add select fields (before the "Group By" clause)
gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "EmployeeID";
gridGroupByField.FieldAlias = "EmployeeIdentificator";
expression.SelectFields.Add( gridGroupByField );
csharp
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

cs-api-definition
[Browsable(true)]
public virtual string FieldName { get; set; }

Property Value

string

Filter

Gets or sets the instance of FilterExpression for this field.

Declaration

cs-api-definition
public virtual FilterExpression Filter { get; set; }

Property Value

FilterExpression

FormatString

Declaration

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

Property Value

string

HeaderText

Gets or sets the expression that will be displayed in the GridGroupHeaderItem.

Declaration

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

Property Value

string

<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

csharp
GridGroupByField gridGroupByField;

gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "EmployeeID";
gridGroupByField.HeaderText = "EmployeeNo";
expression.SelectFields.Add( gridGroupByField );
csharp
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

cs-api-definition
[Browsable(false)]
public virtual bool IsAggregate { get; }

Property Value

bool

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

cs-api-definition
[Browsable(false)]
public virtual bool IsFieldAliasSet { get; }

Property Value

bool

IsFormatStringSet

Gets a value indicating whether the FormatString is set.

Declaration

cs-api-definition
[Browsable(false)]
public virtual bool IsFormatStringSet { get; }

Property Value

bool

IsHeaderTextSet

Gets boolean value indicating whether HeaderText is set. When false, HeaderText will return FieldAlias

Declaration

cs-api-definition
[Browsable(false)]
public bool IsHeaderTextSet { get; }

Property Value

bool

NullValue

Gets or sets an object to be set as the control property when the data source contains a DBNull value.

Declaration

cs-api-definition
[Browsable(false)]
public virtual object NullValue { get; set; }

Property Value

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

cs-api-definition
[Browsable(true)]
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.

Example

csharp
GridGroupByField gridGroupByField;

gridGroupByField = new GridGroupByField();
gridGroupByField.FieldName = "EmployeeID";
gridGroupByField.SortOrder = GridSortOrder.Descending;
expression.GroupByFields.Add( gridGroupByField );
csharp
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

cs-api-definition
public void CopyFrom(GridGroupByField field)

Parameters

field

GridGroupByField

GenerateFieldAlias()

Generates a string value representing the alias of the field based on the FieldName.

Declaration

cs-api-definition
protected string GenerateFieldAlias()

Returns

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

cs-api-definition
public string GetHeaderText()

Returns

string

String containing the HeaderText value

Remarks

Meaningful only for GridGroupByFields from the SelectFields collection

Example

csharp
Dim groupExpression As GridGroupByExpression = RadGrid1.MasterTableView.GroupByExpressions(0)
Dim headerText as String = groupExpression.SelectFields(0).GetHeaderText()
csharp
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

cs-api-definition
public bool IsReferredAs(string name)

Parameters

name

string

The name that is to be checked against.

Returns

bool

true if the current field can be referred as name, else otherwise

ResetFieldAliasCache()

Declaration

cs-api-definition
protected void ResetFieldAliasCache()

SetAggregate(string)

Method setting the aggregate function applied for a GridGroupByField which is part of the SelectFields collection.

Declaration

cs-api-definition
public virtual void SetAggregate(string value)

Parameters

value

string

Remarks

Meaningful only for GridGroupByFields from the SelectFields collection

Example

csharp
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)
csharp
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

cs-api-definition
public void SetSortOrder(string SortOrder)

Parameters

SortOrder

string

Remarks

Meaningful only for GridGroupByFields from the GroupByFields collection

Example

csharp
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);
csharp
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

cs-api-definition
public string ToGroupByString()

Returns

string

ToGroupByString(bool)

Declaration

cs-api-definition
public string ToGroupByString(bool preferAlias)

Parameters

preferAlias

bool

Returns

string

ToSelectString()

Declaration

cs-api-definition
public string ToSelectString()

Returns

string

ToSelectString(string)

Converts to string considering the specific format.

Declaration

cs-api-definition
public string ToSelectString(string defaultFormatString)

Parameters

defaultFormatString

string

The default format string.

Returns

string

ToString()

Method that retrieves a System.String that indicates the current object

Declaration

cs-api-definition
public override string ToString()

Returns

string

The string format of the object.

Overrides object.ToString()

UpdateFormatString(bool, bool)

Declaration

cs-api-definition
public virtual string UpdateFormatString(bool doubleQuote, bool forceChange)

Parameters

doubleQuote

bool

forceChange

bool

Returns

string

UpdateFormatString(string, bool, bool)

Declaration

cs-api-definition
public static string UpdateFormatString(string formatString, bool doubleQuote, bool forceChange)

Parameters

formatString

string

doubleQuote

bool

forceChange

bool

Returns

string

Validate()

Inherited but not used

Declaration

cs-api-definition
public virtual void Validate()

ValidateFormatString()

Declaration

cs-api-definition
public virtual int ValidateFormatString()

Returns

int

ValidateFormatString(string)

Declaration

cs-api-definition
public static int ValidateFormatString(string formatString)

Parameters

formatString

string

Returns

int