locked
Slide show extender not working on site master RRS feed

  • Question

  • User156374417 posted

    I have place the slideshow extender on my site master but it wont work here's my code:

    Site master:

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="SiteMaster" %>
    
    <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head runat="server">
        <title></title>
        <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
        <asp:ContentPlaceHolder ID="HeadContent" runat="server">
        </asp:ContentPlaceHolder>
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
            .style2
            {
                width: 129px;
            }
        </style>
        <%--<script type="text/javascript">
            function pageLoad() {
                var slide = $find('SSBehaviorID');
                slide.add_slideChanging(animateSlides);
                var ae = $find("ae");
                var be = ae.get_OnLoadBehavior();
                var an = be.get_animation();
                fadein = an.get_animations()[1];
                fadeout = an.get_animations()[0];
    
                fadein.set_duration(1.0);
                fadeout.set_duration(1.0);
    
            }
    
            function animateSlides() {
                fadein.play();
                window.setTimeout("fadeout.play()", 2000);
    
            } 
       
        </script>--%>
    </head>
    <body>
        <form runat="server">
        <div class="page">
            <div class="header">
                <div class="title">
                    <table class="style1">
                        <tr>
                            <td>
                                <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" CombineScripts="false"></asp:ToolkitScriptManager>
                                <asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="~/Images/logo.jpg" 
                                    NavigateUrl="~/Home.aspx" Width="181px">HyperLink</asp:HyperLink>
                                <br />
                                <asp:Image ID="Img1" runat="server" Height="97px" Width="952px" 
                                    ImageUrl="~/Images/Image1.jpg" />
                                
                                <asp:SlideShowExtender ID="Img1_SlideShowExtender" runat="server" 
                                    TargetControlID="Img1" AutoPlay="True" Loop="True" SlideShowAnimationType="SlideDown"  
                                    BehaviorID="SSBehaviorID" SlideShowServiceMethod="GetSlides" 
                                    PlayInterval="200" SlideShowServicePath="SlideComplete.asmx"></asp:SlideShowExtender>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="clear hideSkiplink">
                    <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                        <Items>
                            <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home"/>
                            <asp:MenuItem NavigateUrl="~/Cause.aspx" Text="The Cause" Value="The Cause"/>
                            <asp:MenuItem NavigateUrl="~/Statistics.aspx" Text="Statictics" 
                                Value="Statictics">
                                <asp:MenuItem NavigateUrl="~/Hunger.aspx" Text="Hunger" Value="Hunger">
                                </asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/PovertyRate.aspx" Text="Poverty Rate" 
                                    Value="Poverty Rate"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Help.aspx" Text="How Can You Help?" 
                                Value="How Can You Help?">
                                <asp:MenuItem NavigateUrl="~/Cash.aspx" Text="Make a Cash Donation" 
                                    Value="Make a Cash Donation"></asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/Food.aspx" Text="Donate Food" Value="Donate Food">
                                </asp:MenuItem>
                                <asp:MenuItem NavigateUrl="~/Volunteer.aspx" Text="Become a Volunteer" 
                                    Value="Become a Volunteer"></asp:MenuItem>
                            </asp:MenuItem>
                            <asp:MenuItem NavigateUrl="~/Login.aspx" Text="Volunteers" Value="Volunteers">
                            </asp:MenuItem>
                        </Items>
                    </asp:Menu>
                </div>
            </div>
            <div class="clear">
                <table class="style1">
                    <tr>
                        <td class="style2">
                            <br />
                            <br />
                        </td>
                        <td>
                <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="footer">
            
            <span lang="EN-GB" style="font-size:12.0pt;mso-bidi-font-size:
    10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;mso-fareast-font-family:SimSun;
    mso-ansi-language:EN-GB;mso-fareast-language:EN-US;mso-bidi-language:AR-SA">Copyright © 
            All Rights Reserved | Temasek Polytechnic</span></div>
        </form>
    </body>
    </html>
    

    webservice:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using AjaxControlToolkit;
    using System.Web.Script.Services;
    
    /// <summary>
    /// Summary description for WebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService {
    
        public WebService () {
    
            
        }
         public class SlideComplete : WebService
    {
        public SlideComplete()
        {
            
        }
    
        [WebMethod(), ScriptMethod()]
        public AjaxControlToolkit.Slide[] GetSlides(string contextKey)
        {
            return new AjaxControlToolkit.Slide[] { 
             new AjaxControlToolkit.Slide("~/Images/Image1.jpg", "Poverty", "End Poverty"),
            new AjaxControlToolkit.Slide("~/Images/Image2.jpg", "Hunger", "End Hunger"),
            new AjaxControlToolkit.Slide("~/Images/Image3.jpg", "Help", "Help"),
            new AjaxControlToolkit.Slide("~/Images/newbanner.jpg", "banner", "banner")
            };
        }
    
    
    
        
    }
    }
    

    I need to be able to get this AJAX done by today. Help??

    Tuesday, February 11, 2014 12:09 AM

Answers

  • User1734617369 posted

    Hi,

    You have a couple of errors in your code that needs to be corrected, in the master page your SlideShowExtender should look like:

    <asp:SlideShowExtender ID="Img1_SlideShowExtender" runat="server" 
                                    TargetControlID="Img1" AutoPlay="True" Loop="True" SlideShowAnimationType="SlideDown"  
                                    BehaviorID="SSBehaviorID" SlideShowServiceMethod="GetSlides" ContextKey="1" 
                                    PlayInterval="200" SlideShowServicePath="WebService.asmx"></asp:SlideShowExtender>

    and I would consider to increase the play interval since that is a very low value. And your web service should be more like:

    /// <summary>
        /// Summary description for WebService
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        [System.Web.Script.Services.ScriptService]
        public class WebService : System.Web.Services.WebService
        {
            [WebMethod()]
            [ScriptMethod()]
            public AjaxControlToolkit.Slide[] GetSlides(string contextKey)
            {
                return new AjaxControlToolkit.Slide[] { 
                    new AjaxControlToolkit.Slide("~/Images/Image1.jpg", "Poverty", "End Poverty"),
                    new AjaxControlToolkit.Slide("~/Images/Image2.jpg", "Hunger", "End Hunger"),
                    new AjaxControlToolkit.Slide("~/Images/Image3.jpg", "Help", "Help"),
                    new AjaxControlToolkit.Slide("~/Images/newbanner.jpg", "banner", "banner")
                };
            }
        }

    Best regards
    Johan

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 11, 2014 3:28 PM
  • User-417640953 posted

    Hi JustinDC7,

    Thank you post the issue to asp.net forum.

    For using the SlideShowExtender, other member has provided you an example and you can also refer to its' article.

    http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/SlideShow/SlideShow.aspx

    I got this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    For the 500 error, that indicates and error on the server, not anything with your client code. Please check your web service code or debug it.

    http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm

    Hope this helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 12, 2014 1:21 AM

All replies

  • User1734617369 posted

    Hi,

    You have a couple of errors in your code that needs to be corrected, in the master page your SlideShowExtender should look like:

    <asp:SlideShowExtender ID="Img1_SlideShowExtender" runat="server" 
                                    TargetControlID="Img1" AutoPlay="True" Loop="True" SlideShowAnimationType="SlideDown"  
                                    BehaviorID="SSBehaviorID" SlideShowServiceMethod="GetSlides" ContextKey="1" 
                                    PlayInterval="200" SlideShowServicePath="WebService.asmx"></asp:SlideShowExtender>

    and I would consider to increase the play interval since that is a very low value. And your web service should be more like:

    /// <summary>
        /// Summary description for WebService
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        [System.Web.Script.Services.ScriptService]
        public class WebService : System.Web.Services.WebService
        {
            [WebMethod()]
            [ScriptMethod()]
            public AjaxControlToolkit.Slide[] GetSlides(string contextKey)
            {
                return new AjaxControlToolkit.Slide[] { 
                    new AjaxControlToolkit.Slide("~/Images/Image1.jpg", "Poverty", "End Poverty"),
                    new AjaxControlToolkit.Slide("~/Images/Image2.jpg", "Hunger", "End Hunger"),
                    new AjaxControlToolkit.Slide("~/Images/Image3.jpg", "Help", "Help"),
                    new AjaxControlToolkit.Slide("~/Images/newbanner.jpg", "banner", "banner")
                };
            }
        }

    Best regards
    Johan

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 11, 2014 3:28 PM
  • User156374417 posted

    Hi,

    You have a couple of errors in your code that needs to be corrected, in the master page your SlideShowExtender should look like:

    <asp:SlideShowExtender ID="Img1_SlideShowExtender" runat="server" 
                                    TargetControlID="Img1" AutoPlay="True" Loop="True" SlideShowAnimationType="SlideDown"  
                                    BehaviorID="SSBehaviorID" SlideShowServiceMethod="GetSlides" ContextKey="1" 
                                    PlayInterval="200" SlideShowServicePath="WebService.asmx"></asp:SlideShowExtender>

    and I would consider to increase the play interval since that is a very low value. And your web service should be more like:

    /// <summary>
        /// Summary description for WebService
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        [System.Web.Script.Services.ScriptService]
        public class WebService : System.Web.Services.WebService
        {
            [WebMethod()]
            [ScriptMethod()]
            public AjaxControlToolkit.Slide[] GetSlides(string contextKey)
            {
                return new AjaxControlToolkit.Slide[] { 
                    new AjaxControlToolkit.Slide("~/Images/Image1.jpg", "Poverty", "End Poverty"),
                    new AjaxControlToolkit.Slide("~/Images/Image2.jpg", "Hunger", "End Hunger"),
                    new AjaxControlToolkit.Slide("~/Images/Image3.jpg", "Help", "Help"),
                    new AjaxControlToolkit.Slide("~/Images/newbanner.jpg", "banner", "banner")
                };
            }
        }

    Best regards
    Johan

    Some how it still doesn't work. But when I inspect element on Google Chrome, I got this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:50495/Project1/WebService.asmx/GetSlides

    Tuesday, February 11, 2014 6:48 PM
  • User-417640953 posted

    Hi JustinDC7,

    Thank you post the issue to asp.net forum.

    For using the SlideShowExtender, other member has provided you an example and you can also refer to its' article.

    http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/SlideShow/SlideShow.aspx

    I got this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    For the 500 error, that indicates and error on the server, not anything with your client code. Please check your web service code or debug it.

    http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm

    Hope this helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 12, 2014 1:21 AM
  • User156374417 posted

    Fuxiang Zhang - MSFT

    Hi JustinDC7,

    Thank you post the issue to asp.net forum.

    For using the SlideShowExtender, other member has provided you an example and you can also refer to its' article.

    http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/SlideShow/SlideShow.aspx

    JustinDC7

    I got this error: Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    For the 500 error, that indicates and error on the server, not anything with your client code. Please check your web service code or debug it.

    http://pcsupport.about.com/od/findbyerrormessage/a/500servererror.htm

    Hope this helps, thanks.

    Best Regards!

    It worked!!! Thanks!!!! THANK YOU VERY MUCH!!!!

    Wednesday, February 12, 2014 1:49 AM