如何为标题文本中的单词使用不同的颜色 [英] How to use different color for a word inside Header Text
本文介绍了如何为标题文本中的单词使用不同的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Gridview中,我有一个列,其标题文本包含每个条目的实际成本。
我打算将特定单词'Actual'的颜色更改为红色。怎么做?我尝试使用'Span'但不接受。
HeaderText =每个条目的实际成本
In a Gridview I have a column and its header text contains " Actual Cost per entry".
I intend to change the color of the particular word 'Actual' to red. How to make it? I tried with 'Span' but not accepting.
HeaderText= "Actual Cost per entry"
推荐答案
您必须使用模板进行此类修改
you should have to use template to do any modification like this
<asp:gridview id="gvExpences" runat="server" xmlns:asp="#unknown">
<columns>
<asp:templatefield>
<HeaderTemplate>
<span style="color:red;">Actual</span><span style="color:black;"> Cost per entry</span>
</HeaderTemplate>
<itemtemplate>
<asp:label id="lblCost" runat="server" text="<%#Bind("Cost")%>"></asp:label>
</itemtemplate>
</asp:templatefield>
<asp:templatefield>
<HeaderTemplate>
<span style="color:red;">Entry</span><span style="color:black;"> Time</span>
</HeaderTemplate>
<itemtemplate>
<asp:label id="lblCost" runat="server" text="<%#Bind("EntryTime")%>"></asp:label>
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
这篇关于如何为标题文本中的单词使用不同的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文