SIGN UP MEMBER LOGIN:    
ARTICLE

AJAX SlideShowExtender Control

Posted by Purushottam Rathore Articles | AJAX in C# May 06, 2009
This article demonstrates how to use AJAX SlideShowExtender control in ASP.NET applications.
Reader Level:
Download Files:
 

AJAX Slideshow extender control is used to display more then one images in the form of Powerpoint slide show style. AJAX SlideShow extender takes the ID of image control to display the images in it according to the time interval fixed for it. You can also specify the auto start event to change the images in SlideShow extender when the page loads. Also you can enable the loop to run the SlideShow in continuous manner that loads the first image again after displaying the last image and plays the SlideShow repeatedly.

Example:

<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="SlideShow.aspx.cs" Inherits="SlideShow" %>
<%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head runat="server">
   
<title>SlideShow</title>
   
    <script runat="Server" type="text/C#">
   
    [System.Web.Services.WebMethod]
        [System.Web.Script.Services.ScriptMethod]

        public static AjaxControlToolkit.Slide[] GetSlides()
        {
            AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[5];
            slides[0] = new AjaxControlToolkit.Slide("images/Image1.jpg", "First image of my album", "First Image");
            slides[1] = new AjaxControlToolkit.Slide("images/Image2.jpg", "Second image of my album", "Second Image");
            slides[2] = new AjaxControlToolkit.Slide("images/Image3.jpg", "Third image of my album", "Third Image");
            slides[3] = new AjaxControlToolkit.Slide("images/Image4.jpg", "Fourth image of my album", "Fourth Image");
            slides[4] = new AjaxControlToolkit.Slide("images/Image5.jpg", "Fifth image of my album", "Fifth Image");
            return (slides);
        }
    </script>
</
head>
<
body>
   
<form id="form1" runat="server">
   
    <table width="400px" align="center" height="350px" bgcolor="silver">
   
        <tr align="center">
   
            <td>
   
                <asp:ScriptManager ID="ScriptManager2" runat="server" />
   
                <asp:Label ID="lableImageDetail" runat="server" ForeColor="#000000" />
   
            </td>
   
        </tr>
   
        <tr align="center">
   
            <td>
   
                <asp:Image runat="server" ID="image1" Height="250" Width="300" />
   
            </td>
   
        </tr>
   
        <tr align="center">
   
            <td>
   
                <asp:Button ID="buttonPrev" runat="Server" Text="Previous" Width="80px" />
   
                <asp:Button ID="buttonPlay" runat="server" Text="Play" Width="80px" />
   
                <asp:Button ID="buttonNext" runat="Server" Text="Next" Width="80px" />
   
            </td>
   
        </tr>
   
    </table>

   
    <ajaxToolkit:SlideShowExtender ID="slideShowExtender1" runat="Server" TargetControlID="image1"
ImageDescriptionLabelID="lableImageDetail" Loop="true" AutoPlay="true" StopButtonText="Stop"
PlayButtonText="Play" NextButtonID="buttonNext" PreviousButtonID="buttonPrev"
PlayButtonID="buttonPlay" SlideShowServiceMethod="GetSlides" />
   
</form>
</
body>
</
html>


Output: when you run this application you will get the following result and image will be change automatically

Image1.JPG

Figure 1

If you click on stop button then you can change image manually by clicking 'Next' and 'Previous' button.

Image2.JPG

Figure 2

Login to add your contents and source code to this article
share this article :
post comment
 

Very well written. I have web site and want to add this code, but it conflicts with masterpage.

Posted by Rick Warner Feb 23, 2012

thank you a lot! but If I want to show Images which from the database ... Can you give me some advices? thanks again.

Posted by Yuanmao Wang Dec 20, 2010

fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
gggggggggggggggggggggggggggggggggggggggggg
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt

Posted by khamu Oct 27, 2010

thanx alot this post really help me alot in my project....

Posted by sampada jain Sep 04, 2010

Thanks sumit..

Posted by Purushottam Rathore May 22, 2009
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor