The easiest way that I've found of doing it is by setting an event
handler on the ItemDataBound event. Put a placeholder control into
your item template, pull it out on the data bound event, then do:
if (whatever)
plcHolder.Controls.Add("<img src=\"whatever.jpg\" />");
or you could even extend that concept and use an HtmlImage control
(<img runat="server" />) instead of a placeholder ... in fact, that
would be a little nicer.
Hope that helps,
Joel Martinez
http://www.onetug.org - Orlando .NET User Group
http://www.codecube.net - blog
"nicholas" <mu********@hotmail.com> wrote in message news:<Oj**************@TK2MSFTNGP11.phx.gbl>...
How can I show or hide an image in a datagrid depending on a field.
Something like: if myfield <> "" then 'show image' else 'show noimage.gif'
end if
the image field contains the image name
so: 'show image' could be something like <img source="/myfolder<%#
databinder.eval(....) %>" ..... >
THX