Click here to Skip to main content
15,886,199 members
Articles / Web Development / HTML
Article

An ASP.NET Slide Show

Rate me:
Please Sign up or sign in to vote.
3.43/5 (30 votes)
30 Mar 2006CPOL1 min read 351.9K   14K   78   73
A simple slide show using AJAX in ASP.NET.

Introduction

I had been looking for the source of a web-based slide show for my own use. The features I wanted in my slide show pages were that it should dynamically select a picture in the server to display, it should display some transition effects, and it should not cause page refreshing. But I couldn’t find one of this kind. So I decided to code it myself.

There is a lot of source code to make the transition effect using JavaScript. But to address the dynamic selection of the picture to display and to avoid the page from refreshing, I used AJAX. There are a lot of AJAX frameworks and tools out there to choose from. But for this simple task, I just used the ASP.NET2’s built-in AJAX supported class System.Web.UI.ICallbackEventHandler.

The included source code will demonstrate the use of this class, and also how to use JavaScript to make the request to get the next image file and apply the transition effects. One thing I need to mention is when applying transition effects, the next image has to be completely loaded before playing the effect, otherwise, the picture display will not be smooth and will be flickering. I also address this in my JavaScript code.

In fact, this is a part of my photo album web project. For the live demo of the slide show in my photo album, click here.

Using the code

To use the source, unzip the project files to a folder, load the Slideshow.sln in Visual Studio 2005, and run it.

Hope my post is useful to you. Enjoy!

License

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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionThis is very good article. Pin
Jayesh Sorathia22-Feb-13 20:44
Jayesh Sorathia22-Feb-13 20:44 
QuestionMozilla Error Pin
Member 792121723-Jul-12 2:45
Member 792121723-Jul-12 2:45 
QuestionFinally got the concept Pin
Member 466304315-Feb-12 21:06
Member 466304315-Feb-12 21:06 
GeneralMy vote of 5 Pin
Member 466304315-Feb-12 21:05
Member 466304315-Feb-12 21:05 
GeneralMy vote of 4 Pin
veerendra.p22-Jun-11 21:37
veerendra.p22-Jun-11 21:37 
GeneralSlideshow does not ID Pin
55kamelot554-Mar-11 9:26
55kamelot554-Mar-11 9:26 
QuestionSlide show does not work Pin
Coleenh28-Sep-10 2:15
Coleenh28-Sep-10 2:15 
GeneralMozilla FireFox Pin
mohsen.karami2-Aug-10 8:55
mohsen.karami2-Aug-10 8:55 
Generalslide show Pin
naveen.prasad15228-Jun-10 2:56
naveen.prasad15228-Jun-10 2:56 
GeneralMy vote of 1 Pin
ravichaudhari14-Jun-10 23:55
ravichaudhari14-Jun-10 23:55 
GeneralCode Not Compatable with Different Browsers. Pin
AlizaT.Cp3-Dec-09 20:45
AlizaT.Cp3-Dec-09 20:45 
GeneralDemosite Pin
Markus Bertram26-Jul-09 21:03
Markus Bertram26-Jul-09 21:03 
QuestionUrl Path Pin
Manoj Kiean24-Jun-09 21:22
Manoj Kiean24-Jun-09 21:22 
Generalcode for prev and next Pin
thas0229-Jun-09 11:28
thas0229-Jun-09 11:28 
GeneralExcellent Code - Modified !!! Pin
Keith Pitts20-Apr-09 10:32
Keith Pitts20-Apr-09 10:32 
GeneralRe: Excellent Code - Modified !!! Pin
thas0229-Jun-09 11:23
thas0229-Jun-09 11:23 
Hi,
i wud like to use ur code as in using database.could u pls provide me the same.
Regards
GeneralRe: Excellent Code - Modified !!! Pin
Member 792121723-Jul-12 2:51
Member 792121723-Jul-12 2:51 
Questionhow to make every image as a link in slide show Pin
Member 36801427-Apr-09 21:14
Member 36801427-Apr-09 21:14 
Questionhow to using silde show 3 time on one page!! Pin
kenuycyc17-Mar-09 9:17
kenuycyc17-Mar-09 9:17 
QuestionHow to limit transition effects? Pin
Peter Afonin8-Feb-09 16:12
Peter Afonin8-Feb-09 16:12 
GeneralThe Master Page Pin
Shakthivelpr4-Feb-09 23:36
Shakthivelpr4-Feb-09 23:36 
QuestionTransitions in IE AND in Firefox? Pin
PCAssist_Northwest17-Jan-09 21:44
PCAssist_Northwest17-Jan-09 21:44 
GeneralDo you have the code...... Pin
t-hawkbasketball4-Oct-08 14:59
t-hawkbasketball4-Oct-08 14:59 
GeneralDeng It's Awesome!!! Pin
M. Shakeel Anjum21-Jul-08 21:59
M. Shakeel Anjum21-Jul-08 21:59 
GeneralRandom to Ordered Pin
asewefy19-Sep-07 23:17
asewefy19-Sep-07 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.