Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET image databse
i save path and name file in databse
and want to display in repeater
but
the picture don't displayed
please help
tnx
 

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

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:
 
<a href="gallerypic/orginal/12.jpg">
<img src="gallerypic/thumb/12.jpg" />
 
<a href="~/gallerypic/orginal/12.jpg">
<img src="~/gallerypic/thumb/12.jpg" />
Posted 17-Sep-12 4:52am
jiji26631.8K
Comments
sjelen at 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 at 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 at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
jiji2663 at 17-Sep-12 10:08am
   
it's not answer's my question
this link is diffrent of my code
 
tnx
_Amy at 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".
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2
Comments
jiji2663 at 20-Sep-12 11:59am
   
i work with vs 2010
jiji2663 at 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 at 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" ...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

  Permalink  

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

  Print Answers RSS
0 OriginalGriff 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100