Use If Operator
<ItemTemplate>
<asp:Image ID="Image1" runat="server" Width="100px" ImageUrl='<%# If(Eval("Picture").ToString() = "", "", GetImageString64(CType(Eval("Picture"), Byte()))) %>' />
</ItemTemplate>
Here's how it works:
If( argument1, argument2, argument3 )
the above syntax will evaluate argument1
. If argument1
is true, it will return argument2
, otherwise it will return argument3
.
In your case argument1
is Eval("Picture").ToString() = ""
, argument2
is ""
, and argument3
is GetImageString64(CType(Eval("Picture"), Byte()))
.