DataGridColumnCollection.Remove Method
Assembly: System.Web (in system.web.dll)
public void Remove ( DataGridColumn column )
public function Remove ( column : DataGridColumn )
Parameters
- column
The DataGridColumn-derived column to remove from the DataGridColumnCollection.
Use this method to remove the specified DataGridColumn-derived column object from a DataGridColumnCollection collection.
The DataGrid control does not store the contents of its Columns collection in the view state. To add or remove a column dynamically, you must programmatically add or remove the column every time the page is refreshed. Provide a Page_Init function that adds or removes the column before the DataGrid control can reload its state and rebuild itself. Otherwise, the changes to the Columns collection are not reflected in the DataGrid control when it is displayed.
Note |
|---|
| Although you can programmatically add columns to or remove columns from the Columns collection of the DataGrid control, it is easier to list the columns statically and then use the Visible property to display or hide each column. |
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note