System.Web.UI.WebControls Namespace DetailsView Class
.NET Framework version 2.0
Returns a DetailsViewRow object that represents the header row displayed at the top of the DetailsView control.
Script |
[ DetailsViewRow variable = ] DetailsView.HeaderRow |
This property can only be used programmatically; it cannot be set when declaring the control.
The property is read only with no default value.
The header row is displayed at the top of the DetailsView control when the HeaderText or HeaderTemplate property is set. Use the HeaderRow property to programmatically access the DetailsViewRow object that represents the header row.
NOTE: The HeaderRow property is available only after the DetailsView control creates the header row in the ItemCreated event.
This property is commonly used when you need to programmatically manipulate the header row, for example when adding custom content. Any modification to the HeaderRow property must be performed after the DetailsViewRow object that represents the header row has been created; otherwise, the DetailsView control overwrites any changes.
To control the style of the header row, use the HeaderStyle
property.
The following example demonstrates how to programmatically set the style properties of the HeaderRow in the DetailsView control at run time.
void chgSelectedProps ( Object src, EventArgs e ) {
if ( productView.HeaderRow != null ) {
productView.HeaderRow.BackColor = System.Drawing.Color.Khaki;
productView.HeaderRow.ForeColor = System.Drawing.Color.Maroon;
productView.HeaderRow.Font-Bold = true;
}
}
Sub chgSelectedProps ( src As Object, e As EventArgs )
If Not ( productView.HeaderRow Is Nothing ) Then
productView.HeaderRow.BackColor = System.Drawing.Color.Khaki
productView.HeaderRow.ForeColor = System.Drawing.Color.Maroon
productView.HeaderRow.Font-Bold = True
End If
End Sub |
|
C# |
VB |
DetailsViewRow BottomPagerRow FooterRow Row TopPagerRow