How do I load multiple images (approximately 100 images) from a folder to ASP.Net Image Buttons using any loop.
The code is currently resulting in a null value for the image URL.
What I Treid
string Commented = "~/Files/Temp/";
DirectoryInfo dir = new DirectoryInfo(MapPath(Commented));
FileInfo[] suppportimage = dir.GetFiles();
ArrayList listItems = new ArrayList();
int j = 1;
foreach (FileInfo info in suppportimage)
{
listItems.Add(info);
string strFileExtention = System.IO.Path.GetExtension(info.ToString()).ToUpper();
if (strFileExtention == ".JPEG || strFileExtention.ToUpper() == ".JPG")
{
((WebControl)(panelx.FindControl("imgSupport0" + j))).Attributes["ImageUrl"] = Commented + info;
j++;
}
}