Click here to Skip to main content
12,398,225 members (54,339 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET CSS HTML
Hi this code generate all image items in a folder to my page but everything is true just can not show images.
please help me.
thanks.

int ID = Convert.ToInt32(Request.QueryString["ID"].ToString());
                galleryCat = System.IO.Directory.GetDirectories(Server.MapPath(".") + "/Upload/Gallery");
                string tempPath = galleryCat[ID];
 
                string[] GalleryItem = System.IO.Directory.GetFiles(tempPath, "*.jp*");
 
                foreach (string strPath in GalleryItem)
 
                    Literal1.Text += string.Format("<li><a href='{0}' > <asp:Image ID='Image1' runat="'server'" CssClass='img' ImageUrl='{0}' /></a></li>", strPath);
Posted 1-Aug-12 9:36am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

i solve this problem by change this part of code.
Literal1.Text += string.Format("<li><a href=""> <img src="{0}" /></a></li>\n",  strPath);
               Literal1.Text =Literal1.Text.Replace(Server.MapPath("."), "").Replace("\\","/");
  Permalink  
Comments
Kenneth Haugland 1-Aug-12 16:10pm
   
MArk it as answer then :)

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 1 Aug 2012
Copyright © CodeProject, 1999-2016
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