我正在尝试在同一列中的标题文本之后在网格视图标题中添加过滤器图像。我尝试将图像添加到标题,但它只显示图像而不显示文本。
<asp:TemplateField HeaderText="<img src='.../...' alt='my image' />">
....
</TemplateField>
任何人都可以建议我这样做的方法吗
Just do something like this - note the HtmlEncode=false
:
<asp:BoundField HtmlEncode="false"
HeaderText='<img src="http://www.gravatar.com/avatar/8c9778a09696aac804ed44f4c8033458?s=32&d=identicon&r=PG" />Filter' />
It will render an image on the header and the word Filter
next to it.
Try something like this...
<asp:TemplateField>
<HeaderTemplate>Some Header <img src=".../image.png" /></HeaderTemplate>
<ItemTemplate>Your Item</ItemTemplate>
</asp:TemplateField>