Reputation: 167
My web application retrieves the location of an image from database. I'd like to show the image in listview using image control. Although my database gives the correct location of my image, for some reason, my web application cannot render the image file. (When I put the same address in another image control, the image appears.) Does anybody have clue on this matter? Thanks in advance. My codes in listview are:
<ItemTemplate>
<td runat="server" style="">
<asp:Image ID="albumImage" ImageURL = '<%# Eval("imgLocation") %>' runat="server" AlternateText= '<%# Eval("imgLocation") %>' /><br />
<asp:Label ID="albmNameLabel" runat="server" Text='<%# Eval("albmName") %>' />
<br />
</td>
</ItemTemplate>
HTML generated by the portion of my web application is:
<td style="">
<img id="ListView1_albumImage_0" src="C:\odaiba.png" alt="C:\odaiba.png" /><br />
<span id="ListView1_albmNameLabel_0">tokyo trip</span>
<br />
</td>
Upvotes: 1
Views: 2153
Reputation: 77580
Rather than put the image at C:\
, I would strongly urge you to make an images
folder in your web project and update your database to refer to the images with a relative path: images/odaiba.png
.
Upvotes: 1