3
Answers

Need to Show 'NOIMAGE' if no image in datalist ?..,

Karthik Che

Karthik Che

6y
156
1
Hi All ,
 
  I want to show Show Empty Image as 'NOIMGAGE.jpg'  if no image available in my datalist contro.how i can bring it ..Anyone suggest me ?..
     
I can share my code as bellow ..
 
 
<ItemTemplate>
<table style="margin-left:15px" width="960px">
<tr>
<td>
<img src='<%#Eval("Gall_Image1").ToString() %>' onerror="this.onerror=null; this.src='NoImage.jpg';" width="170px" height="140px" />
</td>
<td>
<img src='<%#Eval("Gall_Image2").ToString() %>' onerror="this.onerror=null; this.src='NoImage.jpg';" width="170px" height="140px" />
</td>
<td>
<img src='<%#Eval("Gall_Image3").ToString() %>' onerror="this.onerror=null; this.src='NoImage.jpg';" width="170px" height="140px" />
</td>
<td>
<img src='<%#Eval("Gall_Image5").ToString() %>' onerror="this.onerror=null; this.src='NoImage.jpg';" width="170px" height="140px" />
</td>
</tr>
<br />
</table>
<br />
</ItemTemplate>
 
 
 
Answers (3)