1jaws
asked on
displaying image on datagrid
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?
<telerik:GridTemplateColum n UniqueName="attachment">
<HeaderStyle Width="30px" />
<ItemTemplate>
<asp:Image runat="server" ID="imgAttachment" Visible='<% #Eval("attachment") %>'
ImageUrl="../images/attach ment.jpg" AlternateText="attachment" />
<asp:Label ID="Label1" runat="server" Text='<%# (int)Eval("attachment") ? "NULL" : " " %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColu mn>
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?
<telerik:GridTemplateColum
<HeaderStyle Width="30px" />
<ItemTemplate>
<asp:Image runat="server" ID="imgAttachment" Visible='<% #Eval("attachment") %>'
ImageUrl="../images/attach
<asp:Label ID="Label1" runat="server" Text='<%# (int)Eval("attachment") ? "NULL" : " " %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also you can just use "" instead of " "
when do you get null for id? if you try to set visibility of row all together you can put all items in a server side div...
when do you get null for id? if you try to set visibility of row all together you can put all items in a server side div...
ASKER