DataGridColumn.InitializeCell Method

Provides the base implementation to reset the specified cell from a column derived from the DataGridColumn class to its initial state.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
virtual void InitializeCell (
	TableCell^ cell, 
	int columnIndex, 
	ListItemType itemType
)
public void InitializeCell (
	TableCell cell, 
	int columnIndex, 
	ListItemType itemType
)
public function InitializeCell (
	cell : TableCell, 
	columnIndex : int, 
	itemType : ListItemType
)
Not applicable.

Parameters

cell

A TableCell that represents the cell to reset.

columnIndex

The column number where the cell is located.

itemType

One of the ListItemType values.

The InitializeCell method provides the base implementation to reset the specified cell from a column derived from the DataGridColumn class to its initial state. This method is not called directly. Instead, this method is inherited by a derived column class, which can then be used to reset a cell in the column of the derived type. You can optionally override this method in the derived class to provide a custom initialization routine. This base implementation of the InitializeCell method is often called from the overridden method to reset properties common to all cells in columns derived from the DataGridColumn class.

In this implementation, the InitializeCell method resets only the header and footer cells. Other types of cells are not affected by this method.

When sorting is enabled (by setting the AllowSorting property to true), a LinkButton control is added to the header cell by default. This allows you to sort the column when the LinkButton control is clicked. If you specify an image for the header cell (by setting the HeaderImageUrl property), an ImageButton control is created instead.

When sorting is disabled, the text specified by the HeaderText property is displayed in the header cell. If you specify an image for the header cell (by setting the HeaderImageUrl property), an Image control is added to the header cell.

Because a browser will not display an empty cell, if an image in not displayed in the header cell and the HeaderText property is not set, a nonbreaking space HTML entity ( ) is displayed in the header cell. Similarly, if the footer cell does not have any content (if the FooterText property is not set), a nonbreaking space HTML entity is displayed in the footer cell.

NoteNote:

This method is commonly used by control developers.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: