Hey All,
I have 5 pictures(.jpeg) inside one folder...How do I make all those images get displayed in my .aspx page(like a thumbnail?)?
Can I create objects of Image class inside a for loop and make it display? But in anycase I don't know how to make it display... Should I create a table and make the images to display in each cell??
Any help would be appreciated..

Thanks
Ani

You can use either the repeater control or something along those lines, or use the System.Web.UI.HtmlControls namespace with class Table();

Why use all those? Using server controls is costly, so a repeater would be best. Just create a repeater and bind all your images to an array, then bind it to the datasource. Basically, use the System.IO namespace, loop through each file in the directory and detect if it's a .jpg or .jpeg file, then add the path/filename to the array. After this completes, set the array to the datasource of the repeater and databind. It will automatically do the rest for you.

Thanks for your suggestion..I m really new to this ASP.Net world..Can you help me with some chunks of C# code...By datasource, do you mean a SQL database or something alike?How do I bind images to an array?Create an Image array?

Thanks
Ani

This article has been dead for over six months. Start a new discussion instead.