I have a ton of listviews where previously I was using a database with the absolute reference to where the image was located. The location of the image is stored in the database. In MY database the images pull up fine images/thumbs/something.jpg
in my ListView control, I used <asp:image ID="something" runat="server" imageURL='<%# Eval("ThumbImage") %>' />
But on the server the project is running on now, those images are like so in the database
images\thumbs\something.jpg it's machine reference. How do I get these to show up in my project?!
but when i download the file no problem. I am not sure the problem from the slash. Try open the image drirectly in address bar to make sure you can see it in browser.
If the slash is the real problem you can change your SELECT command to use REPLACE :
SELECT REPLACE([ThumbImage],'\','/') as NewTumbs, ....
bangtheory
Member
52 Points
58 Posts
Images Not Showing in ListView
Dec 08, 2012 02:05 AM|LINK
Hello,
I have a ton of listviews where previously I was using a database with the absolute reference to where the image was located. The location of the image is stored in the database. In MY database the images pull up fine images/thumbs/something.jpg
in my ListView control, I used <asp:image ID="something" runat="server" imageURL='<%# Eval("ThumbImage") %>' />
But on the server the project is running on now, those images are like so in the database
images\thumbs\something.jpg it's machine reference. How do I get these to show up in my project?!
oned_gk
All-Star
35908 Points
7338 Posts
Re: Images Not Showing in ListView
Dec 08, 2012 02:13 AM|LINK
try
<asp:image ID="something" runat="server" imageURL='<%# Eval("ThumbImage","http://yourapp/{0}) %>' />Do you mean getting imageurl from server to your pc? Try above
<asp:image ID="something" runat="server" imageURL='<%# Eval("ThumbImage","~/{0}") %>' />I am not sure what you mean, modify above format.
Suwandi - Non Graduate Programmer
bangtheory
Member
52 Points
58 Posts
Re: Images Not Showing in ListView
Dec 08, 2012 02:35 AM|LINK
Hi oned thanks for looking at this.
I tried this
<asp:image ID="something" runat="server" imageURL='<%# Eval("ThumbImage","~/{0}") %>' />but the images still do not show.
on the database the reference path again is:
images\thumbs\myimage.jpg
The asp:Image control does not like the \ slashes.
oned_gk
All-Star
35908 Points
7338 Posts
Re: Images Not Showing in ListView
Dec 08, 2012 03:07 AM|LINK
I have similar url to a file pdf
http://domainname/abc\folder\filename.pdf
but when i download the file no problem. I am not sure the problem from the slash. Try open the image drirectly in address bar to make sure you can see it in browser.
If the slash is the real problem you can change your SELECT command to use REPLACE :
<asp:image ID="something" runat="server" imageURL='<%# Eval("NewTumbs","~/{0}") %>' />Suwandi - Non Graduate Programmer
bangtheory
Member
52 Points
58 Posts
Re: Images Not Showing in ListView
Dec 08, 2012 04:18 AM|LINK
actually, I got the answer
<asp:image ID="something" runat="server" imageURL='<%#"~/Images/" + Eval("ThumbImage") %>' />this turns all the \ slashes into / slashes. didn't matter which folder my images were in either there was two directories
images/
images/thumbs/
pull images from both.
oned_gk
All-Star
35908 Points
7338 Posts
Re: Images Not Showing in ListView
Dec 08, 2012 06:47 AM|LINK
You can also do like this
<asp:image ID="something" runat="server" imageURL='<%# Eval("ThumbImage","~/images/{0}") %>' />Suwandi - Non Graduate Programmer
bangtheory
Member
52 Points
58 Posts
Re: Images Not Showing in ListView
Dec 08, 2012 02:27 PM|LINK
No that does not work.