ASP.net Image Button- If databound image URL is empty, display image from another URL
Posted on 2007-10-09
I have a datagrid with a template field containing an image button:
<asp:ImageButton ID="ImageButton6" runat="server" CommandName="Select" ImageUrl='<%# Eval("PicURL1") %>' ImageAlign="AbsMiddle" BorderColor="Black" BorderStyle="Double" BorderWidth="3px" Width="50px" />
As you can see, the image URL is bound to a field in my database. I would like to display an image (images/empty.jpg) if the database field does not contain a valid URL, so that I get that image insted of the empty box with the red X...how do I do this? I tried adding a 'nullimageurl' to the image button, but that doesn't work...