displaying image on datagrid
Posted on 2011-10-13
this gives error saying Cannot implicitly convert type 'int' to 'bool'
because my data field for attachment is int and I guess I am trying to use as bool.. but how can I fix that that if my int attachment comes back from database as null value, it wouldnt show the image... thats all I want.. if has int value... that time I want to see image....since I will need the value of the attachment as a int also need to grab the id also while doing this for images display true and false.. maybe need to use something other than GridTemplateColumn?
<HeaderStyle Width="30px" />
<asp:Image runat="server" ID="imgAttachment" Visible='<% #Eval("attachment") %>'
<asp:Label ID="Label1" runat="server" Text='<%# (int)Eval("attachment") ? "NULL" : " " %>'></asp:Label>