Export (0) Print
Expand All

DataControlField.HeaderText Property

Gets or sets the text that is displayed in the header item of a data control field.

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

abstract HeaderText : string with get, set 
override HeaderText : string with get, set

Property Value

Type: System.String
A string that is displayed in the header item of the DataControlField.

Use the HeaderText property to identify a field in a data control with a friendly name. The most common application of the HeaderText property is to provide meaningful column names for data-bound fields in a GridView or DetailsView control.

NoteNote

If both the HeaderText and HeaderImageUrl properties are set, the HeaderImageUrl property has precedence.

The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and ASP.NET Globalization and Localization.

The following code example demonstrates how to declaratively set the HeaderText properties of BoundField columns to display text in the column headers of a GridView control. This code example demonstrates a master-details scenario in which a GridView control is used to display a subset of data while the DetailsView control is used to display a larger set of data and insert new records. The example uses two SqlDataSource controls: one to populate the GridView control and one to populate the DetailsView control and insert data.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

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.

Show:
© 2014 Microsoft