Reputation:
I have a detailsview with a TemplateField:
<Fields>
<asp:TemplateField HeaderText="Band">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("bandname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
How would I apply a style to just the HeaderText, as I wish to make it bold?
Upvotes: 1
Views: 1310
Reputation: 6304
You can do so by adding a <HeaderStyle />
child to your TemplateField
.
The HeaderStyle property governs the appearance of any text displayed in the header item of a type derived from DataControlField.
There you can define the styles inline or specify a CssClass
if you have the styles defined elsewhere.
<Fields>
<asp:TemplateField HeaderText="Band">
<HeaderStyle Font-Bold="true" CssClass="myheaderclass" />
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("bandname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Fields>
Read more: DataControlField.HeaderStyle
Upvotes: 1