3
Answers

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

Karthik Che

Karthik Che

7y
160
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)
0
Karthik Che

Karthik Che

NA 256 120.8k 7y
HI ,
 
  I have checked with my code ., its not working ..
 
see my code : 
 
<img src='<%#Eval("Gall_Image5").ToString()== "blank" ? "no images available" : "img/icons/NoImage.jpg" %> />
 
0
Ravi Polara Patidar

Ravi Polara Patidar

NA 346 4.5k 7y
Hello Karthik Che,
 
It's Simple.
 
 
  1. <img src='<%#Eval("Gall_Image1").ToString()== "blank" ? "no images available" : "image code/path here" %>  />  
0
Ravi Polara Patidar

Ravi Polara Patidar

NA 346 4.5k 7y
Hello Karthik Che,
 
It's Simple.
 
 
  1. <img src='<%#Eval("Gall_Image1").ToString()== "blank" ? "no images available" : "image code/path here" %>  />