Reputation: 1439
If in the html table header, I would use:
<th class="titleclass" width="200"><span>Header Text</span> <sup><a href="#link"><span style="font-size: 12px">1</span></a></sup></th>
How can I use the same header text in bound field of asp.net gridview. I tried the following:
<asp:boundcolumn
visible="True"
datafield="Column1"
headertext="<span>Header Text</span> <sup><a href='#link'><span style='font-size: 12px'>1</span></a></sup>"
HeaderStyle-CssClass="titleclass">
<itemstyle horizontalalign="Left"></itemstyle>
</asp:boundcolumn>
This is not working. It says "There is not source available for the current location" and the style for my header text is not applied (but the style for the superfix number 1 is applied). Any thoughts?
Upvotes: 2
Views: 5737
Reputation: 2670
You can use the HeaderStyle Property of the gridview.
<asp:GridView ID="GridView1" runat="server">
<HeaderStyle CssClass="titleclass"/>
.
.
.
Or you can do it from within your ASP.NET code,
GridView1.Columns[0].HeaderStyle.CssClass = "titleClass";
Hope this helps
Upvotes: 0
Reputation: 1117
Convert your field to Template: 'Edit Columns - Select needed field - Convert to Template'
Edit the header template as desired.
Refer to this link: http://msdn.microsoft.com/en-us/library/bb288032.aspx
Upvotes: 1