I’m attempting to dynamically create a button control for each image I have in a specific folder in my solution.
The folder is located at ProjectName/Images/Slideshow/SectionOne.
I was thinking something along the lines of this:
foreach (Image image in "~/Images/Slideshow/SectionOne")
{
// My button initialization syntax here.
}
This doesn’t work. Am I ignorant of proper syntax for accessing the solution folder, or is this completely the wrong way of going about this task?
All ideas/input appreciated. Thanks.
Guess you could do something like this
But in order to use such path you must use Server.MapPath and you will also need to set the correct web url to the file and not just use what you get form the filepath!