Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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 solution

i solve this problem by change this part of code.
C#
Literal1.Text += string.Format("<li><a href=""> <img src="{0}" /></a></li>\n",  strPath);
               Literal1.Text =Literal1.Text.Replace(Server.MapPath("."), "").Replace("\\","/");
 
Share this answer
 
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


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