Thursday, 15 August 2013

HOW TO USE ASP.NET AJAX SLIDE SHOW EXTENDER

HOW TO USE ASP.NET AJAX SLIDE SHOW EXTENDER


        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
    <h1>ASP.NET AJAX SLIDE SHOW CONTROL DEMO</h1>
    <div>
        <asp:Panel ID="Panel1" runat="server" Width="200px">
        <asp:Image ID="Img1" runat="server" Width="200px" Height="200px" />
</asp:Panel>

<asp:Button ID="btnNext" runat="server" Text="Next" /> &nbsp; &nbsp; <asp:Button ID="btnPlay" runat="server" Text="Play" />
&nbsp; &nbsp; <asp:Button ID="btnPrev" runat="server" Text="Previous" />
        <asp:SlideShowExtender ID="SlideShowExtender1" runat="server" TargetControlID="Img1"
        
         Loop="true" AutoPlay="true" NextButtonID="btnNext" PlayButtonID="btnPlay" PlayButtonText="Play"
          PreviousButtonID="btnPrev" StopButtonText="Stop" SlideShowServiceMethod="GetSlides">
        
        </asp:SlideShowExtender>


web page method

    [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
    public static AjaxControlToolkit.Slide[] GetSlides()
    {
        AjaxControlToolkit.Slide[]  sliders = new AjaxControlToolkit.Slide[4];
        sliders[0] = new AjaxControlToolkit.Slide("./Images/Blue hills.jpg","Blue hills.jpg","Blue hills.jpg");
                sliders[1] = new AjaxControlToolkit.Slide("./Images/Sunset.jpg","Sunset.jpg","Sunset.jpg");
                sliders[2] = new AjaxControlToolkit.Slide("./Images/Water lilies.jpg","Water lilies.jpg","Water lilies.jpg");
                sliders[3] = new AjaxControlToolkit.Slide("./Images/winter.jpg","winter.jpg","winter");
                return sliders;
    }