I thought I had this answered from a question I asked earlier, but I've had to revisit. I have an asp.ne/c# page that does various things. One of them is to take a powerpoint file the user has uploaded and create thumbnail images of each slide. It creates a new folder to put the images in, then is supposed to display the images on the page. I use a datalist to display the images. It was working great until the requirement came to create a new folder for each new ppt. I have everything working except the display of the images. My datalist code is attached. This used to be right, but now I need to reference a folder inside the images folder. How can I do that within this code? I have a variable available in the code behind page. Can I use it, for example ("~/")%>images/newPath/<%.
. . .Thanks for any help.
<asp:DataList id-"dlImages" runat="server" RepeatDirection="vertical">
<a href='<% ResolveUrl("~/") %>images/<%# GetFileName(Container.DataItem.ToString()) %>' target="main">
<img src='<%= ResolveUrl("~/") %>images/<%# GetFileName(Container.DataItem.ToString()) %>' id="listimage" alt="test" height="150" width="150" /></a>
GetFileName Function in code behind:
protected string GetFileName(string path)
return path.Substring(path.LastIIndexOf("\\") + 1);