1

I am trying add an filter image in grid view header after header text in same column. I tried adding image to header but it only shows image but not the text along with it.

<asp:TemplateField HeaderText="<img src='.../...' alt='my image' />">
....
</TemplateField>

Can anybody suggest me the way to do it

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

Try something like this...

<asp:TemplateField>
<HeaderTemplate>Some Header <img src=".../image.png" /></HeaderTemplate>
<ItemTemplate>Your Item</ItemTemplate>
</asp:TemplateField>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.