Reputation: 663
I have an asp:GridView which includes many BoundField's. One of the fields, called 'status' shows a value of either 1, 2 or 3 (which is got from a column in the database, obviously).
Is there a way I can replace these numbers with images instead?
i.e.
1 = <img src="img1.png" />
2 = <img src="img2.png" />
3 = <img src="img3.png" />
Upvotes: 0
Views: 854
Reputation: 46879
Yes, using a template field you can do something like this:
<asp:TemplateField HeaderText="Image" >
<ItemTemplate >
<asp:Image ID="Image1" runat="server" ImageUrl='<%# "~/images/img" & Eval("Status") & ".png" %>'
</ItemTemplate>
</asp:TemplateField>
Upvotes: 1