ASP.NET SlideShowExtender retrieving images from web service, but doing nothing when executed

Go To StackoverFlow.com

1

So on my ASP.NET solution's default page, I have a SlideShowExtender object, linked to a WebMethod which retrieves slides from an MSSQL database. Through debugging I can confirm that Slide objects are successfully created from said database, but once the page has loaded the SlideShow element does nothing.

Below is my code; I appreciate in advance any responses received. Thank you.

Edit: I forgot to mention that I've have verified the integrity of the Image URLs; they're correct.

Default.aspx (Default.aspx.cs is just a standard code-behind with an empty Page_Load method):

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="Dissertation._Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ToolkitScriptManager ID="scrptman" runat="server"></asp:ToolkitScriptManager>
        <asp:Image ID="imgBanner" Width="800" Height="300" runat="server"/>
        <br />
        <asp:Label ID="lblDesc" runat="server"></asp:Label>
        <asp:SlideShowExtender ID="sldShow" runat="server"   
        TargetControlID="imgBanner" 
        SlideShowServicePath="~/BannerImages.asmx"
        SlideShowServiceMethod="GetPhotos"   
        AutoPlay="true"    
        ImageDescriptionLabelID="lblDesc" 
        Loop="true" />
</asp:Content>

BannerImages.asmx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;
using AjaxControlToolkit;

namespace Dissertation
{
/// <summary>
/// Summary description for BannerImages
/// </summary>
/// 
[System.Web.Script.Services.ScriptService]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class BannerImages : System.Web.Services.WebService
{

    [WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public Slide[] GetPhotos()
    {
        List<Slide> images = new List<Slide>();
        ConnectionStringSettings settings = System.Configuration.ConfigurationManager.ConnectionStrings["Database"];
        SqlConnection conn = new SqlConnection(settings.ConnectionString);
        SqlCommand cmd = new SqlCommand("Select * from sol_bannerData", conn);
        SqlDataReader read = null;
        try
        {
            conn.Open();
            read = cmd.ExecuteReader();

            while(read.Read())
            {
                images.Add(new Slide(Server.MapPath("~/cms/uploads/banners/" + read["ImageURL"].ToString()), "", read["Description"].ToString()));
            }
        }
        catch(SqlException err)
        {
            images.Clear();
            images.Add(new Slide("", "", "Images could not be loaded: " + err.Message));
            return images.ToArray();
        }
        finally
        {
            if(read != null) read.Close();
            if(conn != null) conn.Close();
        }
        Slide[] toReturn = images.ToArray();
        return toReturn;




    }
}
}
2012-04-03 22:45
by James Wright


1

Problem solved; I used jquery.cycle.all instead.

2012-04-04 16:12
by James Wright
Ads