I have a website with an image gallery. I want to dynamically add the pictures to the gallery. I have this code:
string[] files = Directory.GetFiles(Server.MapPath(@"images\gallery\projects"));
string temp = files[0];
for (int i = 1; i < files.Length; i++)
{
HyperLink hp = new HyperLink();
hp.ImageUrl = "images/gallery/projects/" + Path.GetFileName(files[i]);
hp.NavigateUrl = "images/gallery/projects/" + Path.GetFileName(temp);
Panel1.Controls.Add(hp);
temp = files[i];
}
That iterates the folder with pictures and generates link tag but its not what I need. I am trying to generate this tag:
<a href="images/gallery/picture_fullsize.jpg"
title="Caption for picture goes here">
<img src="images/gallery/picture_thumbnail.jpg"/>
</a>
Any pointers or solution would be much appreciated.