I generate my image src from databse field called [pictureName]. I want when Picture name is null or the name doesn't return image to display [image not found] picture.
Here is my aspx code to generate img:
<img src="WEBIMAGES/<%#Eval("BrandName")%>/<%# Eval("PictureName") %>" alt="" title="<%# Eval("ProductName") %>">
my images divided into folders for each brand. i have noImage.jpg in every folder.
how to display this image when no image displayed.
I'm using asp.net webforms
I tried to use onerror event, but not working.
Thanks in advance
Anonymous User
16-Jan-2015You could use a coalesce on the picture name as follows:
<img src="WEBIMAGES/<%#Eval("BrandName")%>/<%# Eval("PictureName") ?? 'noImage.jpg' %>" alt="" title="<%# Eval("ProductName") %>">