Click here to Skip to main content
15,940,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all.
i am using below coding to slides images one by one.
I want to present slide show of all images of a folder.
is it possible?
Please help me.

<div class="imageElement">
					<p>Omaxe Ltd</p>
					<a href="#" title="open image" class="open"></a>
					<img src="HRUploads/pic_omaxe.jpg"class="full" />
					<img src="HRUploads/pic_omaxe.jpg" class="thumbnail" />
			<div class="imageElement">
					<h3>Omaxe Group</h3>
					<p>Shri Rohtas Goel, CMD, OMAXE Group at the ceremony</p>
					<a href="#" title="open image" class="open"></a>
					<img src="HRUploads/97_DSC_7997.gif"class="full" />
					<img src="HRUploads/97_DSC_7997.gif" class="thumbnail" />
				<div class="imageElement">
					<h3>Farm House</h3>
					<p>APE first batch</p>
					<a href="#" title="open image" class="open"></a>
					<img src="HRUploads/CMD_FARM_HOUSE_PHOTO_1.jpg"class="full" />
					<img src="HRUploads/CMD_FARM_HOUSE_PHOTO_1.jpg" class="thumbnail" />

Thanks in advance.
Updated 1-Sep-11 20:53pm

I am assuming you don't want to copy the div tag for each image in your HTML as it will be a maintenance headache.

To avoid it, you can create a custom control to read the folder and emit div tag (as in your code) per image. if you want to store properties for each file (like user friendly name etc) then you can store that in XML and read it from there.

There are plenty of articles if you google on how to create a custom control but here are the steps in brief.
1. Create a class library project or use existing  and add item - server control.
2. Read the files from folder (you can have folder path as a public property in order to reuse the control) and emit HTML per image.

To emit HTML per image - there are three options-
1. you can override RenderContents method and emit HTML as a string. Note your custom control derives from Web control, so its already part of page controls whichever page you put it on.
2. you cab override CreateChildControls and add child controls. you can add image control and literal control for plain HTML.
3. you can override OnLoad (in case you want to hook up events to images)

Finally place the control on your page. You might have to add your control in toolbox first (google for how to do it. its easy). Set the properties in page source or at run time and you will be good to go.

Sorry I dont have ready to copy code unfortunately. I can only tell you the direction but you will have to write the code yourself or google copy it.
Share this answer
Share this answer
uspatel 27-Aug-11 0:58am    
I ahve not problem in slide show,but i want only know to show all folder images without taking div repetedly for each image

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900