This might be useful for you if you need to use a link on your images. If you don't use it as a hyperlink, there probably are other alternatives, or you can 'protect' your image so that it does not function as a hyperlink and not need a NavigateURL. ImageURL below can be dynamically defined in the code-behind
<asp:TemplateColumn SortExpression="YourImageSort" HeaderText="YourImageHeaderText" HeaderImageUrl="Includes/YourImage.gif">
<ItemTemplate>
<asp:HyperLink id="yourimage" runat="server" ImageUrl="Includes/YourImage.gif" Width="15px" Text='<%# DataBinder.Eval(Container, "DataItem.Your_Image") %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
---code-behind---
HyperLink objyourimage = null;
objyourimage = (HyperLink)e.Item.FindControl("Your_Image");
if (objyourimage != null) {
objyourimage.NavigateUrl = strPathName;
objyourimage.ImageUrl = "Includes/YourImage.gif"
}
Watch out for a 'gotcha' though if you have the Image show on the Header - in my case it obtained the same properties of the preceding default Command button so I had to kludge my way around this bug. Probably no problems if you do not put your image in a grid Header.