Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i save path and name file in databse
and want to display in repeater
but
the picture don't displayed
please help
tnx


ASP.NET
<asp:Repeater ID="Repeater1" runat="server">
   <ItemTemplate>
     <a href="<%#Eval("filenameOrginal") %>">
     <img src="<%#Eval("flienameThumb") %>" />   </a>
   </ItemTemplate>
</asp:Repeater>



C#
dal db = new dal();
DataTable dt = new DataTable();
dt = db.run_dr("select * from picgallery where show='true' ");
Repeater1.DataSource = dt;
Repeater1.DataBind();


i save path and name of file to database like this:
gallerypic/orginal/12.jpg

i try this to:
~/gallerypic/orginal/12.jpg
or:
../gallerypic/orginal/12.jpg

in source code of browser:

HTML
<a href="gallerypic/orginal/12.jpg">
<img src="gallerypic/thumb/12.jpg" />


HTML
<a href="~/gallerypic/orginal/12.jpg">
<img src="~/gallerypic/thumb/12.jpg" />
Posted
Comments
sjelen 17-Sep-12 11:40am    
Are the images (jpg files) on file system?
In that case can you show us folder structure?
Where is the page located, related to images folder?
You're probably having trouble with relative paths.
jiji2663 17-Sep-12 13:19pm    
yes jpg and png,jpeg,gif
my folder project is "anjoman"
and folder of picture is "picgallery" into "anjoman"

jiji2663 17-Sep-12 13:27pm    
when i save image into "anjoman" the browser displayed picture
but when save pic into "/anjoman/picgallery" browser doesn't work

Probably you should use a handler to show the image from database. The procedure of mapping the images from handler in repeater is same as gridview.
Refer the links below:
Using the ASP.NET Repeater Control [^]
Inserting images into database and display it in gridview through handler.ashx[^]


--Amit
 
Share this answer
 
Comments
jiji2663 17-Sep-12 10:08am    
it's not answer's my question
this link is diffrent of my code

tnx
_Amy 17-Sep-12 10:16am    
You need to use a handler to display the image from database. And these links are telling about "How to use handler actually".
Check file system permissions for "picgallery" folder.
Also check the names of you folder, first you say "gallerypic" then "picgallery".

Did you put your app in IIS or are you running on VS deveop. web server?
Dev. server can sometimes 'forget' to serve images, try deploying app ti IIS.
 
Share this answer
 
v2
Comments
jiji2663 20-Sep-12 11:59am    
i work with vs 2010
jiji2663 20-Sep-12 12:01pm    
when i save image into "anjoman" the browser displayed picture but when save pic into "/anjoman/picgallery" browser doesn't displayed picture
"anjoman" name's of root folder project
sjelen 21-Sep-12 6:30am    
did you check folder names? You say you save images to "/anjoman/picgallery", but in html you refer to "gallerypic" folder.
Also, I think that application root '~' only works with server-side controls, try <asp:Image> instead of <img>, or try <img runat="server" ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900