How do I create a asp.net page that will allow me to give the user the ability to navigate
through a folder of images?
Or is there a better way to diaplay a page of images?
Thanks for any help.
Printable View
How do I create a asp.net page that will allow me to give the user the ability to navigate
through a folder of images?
Or is there a better way to diaplay a page of images?
Thanks for any help.
That's a somewhat generic question, isn't it?
You'd first enumerate all the images in the said folder, store the paths in a collection. You can work with the collection and an associated variable to give you things like the number of images, etc.
You can then simply set the imageurl of your image control to the collection's item's value.
Not even. It specific and to the point. :D
So would I enumerate the images in the forlder into an arraylist or it has to be a class that inherits collection base?
No difference. You only need to hold the object in your session variable. It's only a matter of maintaining the current image number.
Pretend I am a ASP.NET n00b and explain in detail and please speak slowly so I can write it down as you speak. :D
Use the file class to list all the image files in a given directory.
Add each file name to an array, FILEARRAY. An example of an entry would be "nudemendhak.jpg"
Create a variable to hold the current position. INTBOOKMARK, initial value 0.
Add FILEARRAY to viewstate.
Set the URL of your IMAGE control to the entry in the 0th position of FILEARRAY, it should end up something like: "images/nudemendhak.jpg"
Set the link on your "next" button to the same pagename and append "?imagenumber=" & INTBOOKMARK + 1. (Of course you'll do proper checks like making sure that intbookmark+1 is not greater than the upperbound of the array).
Do the same for your previous button, again with checks that INTBOOKMARK-1 is not less than 0.
Your page, when loading, will check Request.QueryString() for imagenumber, and set the bookmark to that number. And you will load the corresponding image in the array.
Thanks for the info. That is what I needed. When I get home I will try it out. So until then the thread's on hold.