This is the collection of DataGridColumn objects in a DataGrid control. It is provided through the DataGrid.Columns property. You can use this collection to programmatically add or remove columns, but these changes will not be automatically persisted over postbacks because the DataGrid.Columns property is not stored in view state. This collection will only contain columns that have been added through templates, not automatically generated ones.
public sealed class DataGridColumnCollection : ICollection, IEnumerable, System.Web.UI.IStateManager { // Public Constructors public DataGridColumnCollection(DataGrid owner, System.Collections.ArrayList columns); // Public Instance Properties public int Count{get; } // implements ICollection public bool IsReadOnly{get; } public bool IsSynchronized{get; } // implements ICollection public object SyncRoot{get; } // implements ICollection public DataGridColumn this[int index]{get; } // Public Instance Methods public void Add(DataGridColumn column); public void AddAt(int index, DataGridColumn column); public void Clear( ); public void CopyTo(Array array, int index); // implements ICollection public IEnumerator GetEnumerator( ); // implements IEnumerable public int IndexOf(DataGridColumn column); public void Remove(DataGridColumn column); public void RemoveAt(int index); }