GridColumnCollection
The collection of columns of RadGrid or its tables. Accessible through Columns property of RadGrid and GridTableView (MasterTableView) classes.
Its items are of the available Grid column types.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public class GridColumnCollection : IList, ICollection, IEnumerable, IStateManager
Inheritance: objectGridColumnCollection
Implements:
Inherited Members
Example:
GridBoundColumn boundColumn;
boundColumn = new GridBoundColumn();
boundColumn.DataField = "CustomerID";
boundColumn.HeaderText = "CustomerID";
RadGrid1.MasterTableView.Columns.Add(boundColumn);
boundColumn = new GridBoundColumn();
boundColumn.DataField = "ContactName";
boundColumn.HeaderText = "Contact Name";
RadGrid1.MasterTableView.Columns.Add(boundColumn);
RadGrid1.MasterTableView.Columns.Add( new GridExpandColumn() );
Dim boundColumn As GridBoundColumn
boundColumn = New GridBoundColumn()
boundColumn.DataField = "CustomerID"
boundColumn.HeaderText = "CustomerID"
RadGrid1.MasterTableView.Columns.Add(boundColumn)
boundColumn = New GridBoundColumn()
boundColumn.DataField = "ContactName"
boundColumn.HeaderText = "Contact Name"
RadGrid1.MasterTableView.Columns.Add(boundColumn)
RadGrid1.MasterTableView.Columns.Add(New GridExpandColumn())
Constructors
public GridColumnCollection(GridTableView owner, ArrayList columns)
Properties
Gets the number of columns added programmatically or declaratively.
[Browsable(false)]
public int Count { get; }
Implements:
Note that this is not the actual number of column in a GridTableView. See also RenderColumns
Gets a value indicating whether the collection has a fixed size.
public bool IsFixedSize { get; }
true if the collection has a fixed size; otherwise, false.
Implements:
Gets a value indicating whether the collection is read-only.
[Browsable(false)]
public bool IsReadOnly { get; }
true if the collection is read-only; otherwise, false.
Implements:
Gets a value indicating whether access to the collection is synchronized (thread safe).
[Browsable(false)]
public bool IsSynchronized { get; }
true if access to the collection is synchronized (thread safe); otherwise, false.
Implements:
Gets an object that can be used to synchronize access to the collection.
[Browsable(false)]
public object SyncRoot { get; }
An object that can be used to synchronize access to the collection.
Implements:
public GridColumn this[int index] { get; }
If the column/detail table structure is created after the control has been initialized (indicated by RadGrid.Init event ) the state of the columns/detail tables may have been lost. This happens when properties have been set to GridColumn/GridTableView instance before it has been added to the corresponding collection of Columns/DetailTables. Then a GridException is thrown with message: "Failed accessing GridColumn by index. Please verify that you have specified the structure of RadGrid correctly."
Methods
Adds a column object to the GridColumnCollection.
public void Add(GridColumn column)
The GridColumn object to add to the collection.
Adds a column in the collection at the specified index.
public void AddAt(int index, GridColumn column)
The index where the column will be inserted.
columnGridColumnThe column that will be inserted.
Removes all column from the collection.
public void Clear()
Implements:
Determines whether the CridColumnCollection contains the value specified by the given GridColumn object.
public void CopyTo(Array array, int index)
The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.
indexintThe zero-based index in array at which
copying begins.
array is null.
index is less than zero.
array is multidimensional.-or- The number of elements in the
source ICollection is greater than the available
space from index to the end of the destination array.-or-
The type of the source collection cannot
be cast automatically to the type of the destination array.
Implements:
protected virtual GridColumn CreateColumnFromTypeName(string columnTypeName)
Gets all columns found bound to the DataField specified. Returns null is no column is bound to this DataField
Gets the first column found bound to the DataField. Throws GridException if no column is bound to this DataField
Gets the first column found bound to the DataField. Returns null is no column is bound to this DataField
Gets the first column with UniqueName found. Throws GridException if no column is found.
Gets the first column with UniqueName found. Returns null if no column is found.
Returns an enumerator that iterates through a collection.
public IEnumerator GetEnumerator()
An IEnumerator object that can be used to iterate through the collection.
Implements:
Determines the index of a specific column in the GridColumnCollection.
public int IndexOf(GridColumn column)
The GridColumn to locate in the GridColumnCollection.
Returns:The index of value if found in the collection; otherwise, -1.
Inserts a column to the GridColumnCollectino at the specified index.
public void Insert(int Index, object Val)
The zero-based index at which column should be inserted.
ValobjectThe GridColumn to insert into the collection.
Implements:
Removes the first occurrence of a column from the GridColumnCollection.
public void Remove(GridColumn column)
The column to remove from the collection.
Removes the first occurrence of an object from the GridColumnCollection.
public void Remove(object Val)
The object to remove from the collection.
Implements:
Removes the GridColumnCollection item at the specified index.
public void RemoveAt(int index)
The zero-based index of the item(column) to remove.
Implements: