Gets a collection of objects that represent the columns of the DataGrid control.
Assembly: System.Web (in System.Web.dll)
[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>] abstract Columns : DataGridColumnCollection with get [<PersistenceModeAttribute(PersistenceMode.InnerProperty)>] override Columns : DataGridColumnCollection with get
Property ValueType: System.Web.UI.WebControls.DataGridColumnCollection
A DataGridColumnCollection object that contains a collection of objects that represent the columns of the DataGrid control.
Explicitly declared columns may be used in conjunction with automatically generated columns. When using both, explicitly declared columns will be rendered first, followed by the automatically generated columns. Automatically generated columns are not added to the collection.
The order that the columns are displayed in the DataGrid control is controlled by the order that the columns appear in the collection.
The following table shows the different column classes that derive from the DataGridColumn class and can be used in the collection.
Displays a column bound to a field in a data source. It displays each item in the field as text. This is the default column type of the DataGrid control.
Displays a command button for each item in the column. This allows you to create a column of custom button controls, such as the Add or Remove button.
Displays a column that contains editing commands for each item in the column.
Displays the contents of each item in the column as a hyperlink. The contents of the column can be bound to a field in a data source or static text.
Displays each item in the column following a specified template. This allows you to provide custom controls in the column.
Although you can programmatically add columns to the collection, it is easier to list the columns statically and then use the Visible property to show or hide the column.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.