I currently have something like this in a GridView:
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<a href='Link/<%# Eval("Id") %>'>
<img src="/App_Themes/Default/Images/Icons/<%# Eval("Icon") %>" alt="Icon" />
<%# Eval("Name") %>
</a>
</ItemTemplate>
</asp:TemplateField>
It works fine, but I don't want to reference App_Themes directly. I know I can create a skin for each image, but I don't know what icon will be used ahead of time. If I have runat="server"
, I can't use Eval() (designer-generated properties can't be dynamic).
Is there any way to do this only with markup? If not, what's the recommended approach?