Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET SlideShowExtender retrieving images from web service, but doing nothing when executed
    primarykey
    data
    text
    <p>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.</p> <p>Below is my code; I appreciate in advance any responses received. Thank you.</p> <p><strong>Edit:</strong> I forgot to mention that I've have verified the integrity of the Image URLs; they're correct.</p> <p><strong>Default.aspx (Default.aspx.cs is just a standard code-behind with an empty Page_Load method):</strong></p> <pre><code>&lt;%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Dissertation._Default" %&gt; &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt; &lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;asp:ToolkitScriptManager ID="scrptman" runat="server"&gt;&lt;/asp:ToolkitScriptManager&gt; &lt;asp:Image ID="imgBanner" Width="800" Height="300" runat="server"/&gt; &lt;br /&gt; &lt;asp:Label ID="lblDesc" runat="server"&gt;&lt;/asp:Label&gt; &lt;asp:SlideShowExtender ID="sldShow" runat="server" TargetControlID="imgBanner" SlideShowServicePath="~/BannerImages.asmx" SlideShowServiceMethod="GetPhotos" AutoPlay="true" ImageDescriptionLabelID="lblDesc" Loop="true" /&gt; &lt;/asp:Content&gt; </code></pre> <p><strong>BannerImages.asmx.cs</strong></p> <pre><code>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 { /// &lt;summary&gt; /// Summary description for BannerImages /// &lt;/summary&gt; /// [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&lt;Slide&gt; images = new List&lt;Slide&gt;(); 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; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload