New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

A collection of GridSortExpression objects. Depending on the value of AllowMultiColumnSorting it holds single or multiple sort expressions.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[TypeConverter(typeof(ExpandableObjectConverter))]
public class GridSortExpressionCollection : IList, ICollection, IEnumerable, IStateManager

Inheritance: objectGridSortExpressionCollection

Implements: ICollectionIEnumerableIListIStateManager

Inherited Members object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

Initializes a new instance of the GridSortExpressionCollection class.

C#
public GridSortExpressionCollection()

Initializes a new instance of the GridSortExpressionCollection class with the specified list.

C#
public GridSortExpressionCollection(ArrayList list)
Parameters:listArrayList

Properties

If false, the collection can contain only one sort expression at a time. Trying to add a new one in this case will delete the existing expression or will change the sort order if its FiledName is the same.

C#
[Browsable(false)]
public bool AllowMultiColumnSorting { get; set; }

Allow the no-sort state when changing sort order.

C#
[Browsable(false)]
public bool AllowNaturalSort { get; set; }

Returns the number of items in the GridSortExpressionCollection.

C#
[Browsable(false)]
public int Count { get; }

Implements: ICollection.Count

Gets a value indicating whether access to the GridSortExpressionCollection is synchronized (thread safe).

C#
[Browsable(false)]
public bool IsSynchronized { get; }

Implements: ICollection.IsSynchronized

Gets an object that can be used to synchronize access to the GirdSortExpressionCollection.
C#
[Browsable(false)]
public object SyncRoot { get; }

Implements: ICollection.SyncRoot

This is the default indexer of the collection - takes an integer value.

C#
public GridSortExpression this[int index] { get; set; }
Parameters:indexint

Methods

Adds a GridSortExpression to the collection.

C#
public int Add(object value)
Parameters:valueobjectReturns:

int

Implements: IList.Add(object)

Adds a GridSortExpression to the collection at the specified index.

C#
public void AddAt(int index, GridSortExpression sortExpression)
Parameters:indexintsortExpressionGridSortExpression

As a convenience feature, adding at an index greater than zero will set the AllowMultiColumnSorting to true.

If AllowMultiColumnSorting is true adds the sortExpression in the collection. Else any other expression previously stored in the collection wioll be removed

C#
public void AddSortExpression(GridSortExpression sortExpression)
Parameters:sortExpressionGridSortExpression

If AllowMultiColumnSorting is true adds the sortExpression in the collection. Else any other expression previously stored in the collection wioll be removed

C#
public void AddSortExpression(string expression)
Parameters:expressionstring

String containing sort field and optionaly sort order (ASC or DESC)

Adds the sort field (expression parameter) if the collection does not alreqady contain the field. Else the sort order of the field will be inverted. The default change order is Asc -> Desc -> No Sort. The No-Sort state can be controlled using AllowNaturalSort property

C#
public void ChangeSortOrder(string expression)
Parameters:expressionstring

Clears the GridSortExpressionCollection of all items.

C#
public void Clear()

Implements: IList.Clear()

Returns true or false depending on whether the specified sorting expression exists in the collection. Takes a string parameter.

C#
public bool ContainsExpression(string expression)
Parameters:expressionstringReturns:

bool

Returns true or false depending on whether the specified sorting expression exists in the collection. Takes a GridSortExpression parameter.

C#
public bool ContainsSortExpression(GridSortExpression sortExpression)
Parameters:sortExpressionGridSortExpressionReturns:

bool

Returns an enumerator that iterates through the GridSortExpressionCollection.

C#
public IEnumerator GetEnumerator()
Returns:

IEnumerator

Implements: IEnumerable.GetEnumerator()

Find a SortExpression in the collection if it contains any with sort field = expression

C#
public GridSortExpression GetExpression(string expression)
Parameters:expressionstring

sort field

Returns:

GridSortExpression

Get a comma separated list of sort fields and sort-order, in the same format used by DataView.Sort string expression. Returns null (Nothing) if there are no sort expressions in the collection

C#
public string GetSortString()
Returns:

string

Comma separated list of sort fields and optionaly sort-order, null if there are no sort expressions in the collection

Searches for the specified GridSortExpression and returns the zero-based index of the first occurrence within the entire GridSortExpressionCollection.

C#
public int IndexOf(GridSortExpression gridSortExpression)
Parameters:gridSortExpressionGridSortExpressionReturns:

int

Removes the specified GridSortExpression from the collection.

C#
public void RemoveSortExpression(GridSortExpression sortExpression)
Parameters:sortExpressionGridSortExpression

Tries to find a GridSortExpression by providing an expression string. Otherwise returns false.

C#
public bool TryGetExpression(string expression, out GridSortExpression sortExpression)
Parameters:expressionstring

The expression to search for.

sortExpressionGridSortExpression

The sort expression.

Returns:

bool

Returns false a sort expression have not been found.