Click here to Skip to main content
12,949,481 members (69,228 online)
Rate this:
Please Sign up or sign in to vote.
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.

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
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("\\","/");
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
OriginalGriff 5,489
CHill60 3,330
Maciej Los 2,913
Jochen Arndt 1,935
ppolymorphe 1,820

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