Solved

Images wont change with ajax toolkit slideshow extender

Posted on 2009-04-07
6
1,740 Views
Last Modified: 2012-05-06
I recently went through the online videa at MS to create a slide show page using the slideshow extender.  The page loads, and at first, appears to work normally, but the images dont change.

My code for the page and the SlideService is below.  Any help would be greatly appreciated.
******************slideshow.aspx*******************
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="slideshow.aspx.vb" Inherits="slideshow" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
 
<!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>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"  >
    </cc1:ToolkitScriptManager>
    <div style="text-align:center">
        <asp:Image ID="Image1" runat="server" 
                   Height="600px" 
                   style="border:1px solid black; 
                   width:auto" 
                   ImageUrl="~/pics/DSC_1782.JPG" 
                   AlternateText="First Lacrosse Pic" />
<br />
        <asp:Label ID="lblImage1" runat="server"></asp:Label>
<br />
        <asp:Button ID="btnPrev" runat="server" Text="Prev" />
        <asp:Button ID="btnPlay" runat="server" Text="Play" />
        <asp:Button ID="btnNext" runat="server" Text="Next" />
        <cc1:SlideShowExtender ID="SlideShowExtender1" runat="server" 
                               TargetControlID="Image1" 
                               SlideShowServicePath="SlideService.asmx" 
                               SlideShowServiceMethod="GetSlides" 
                               AutoPlay="true" 
                               ImageDescriptionLabelID="lblImage1" 
                               NextButtonID="btnNext" 
                               PlayButtonID="btnPlay" 
                               PlayButtonText="Play" 
                               StopButtonText="Stop"
                               PreviousButtonID="btnPrev" />
    </div>
    </form>
</body>
</html>
 
 
********************SlideService.vb****************************
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
 
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class SlideService
    Inherits System.Web.Services.WebService
 
    <WebMethod()> _
    Public Function GetSlides() As AjaxControlToolkit.Slide()
        Dim mySlides(5) As AjaxControlToolkit.Slide
        mySlides(0) = New AjaxControlToolkit.Slide("~/pics/DSC_1782.jpg", "pic1", "First Lacrosse Picture")
        mySlides(1) = New AjaxControlToolkit.Slide("~/pics/DSC_1783.jpg", "pic2", "Second Lacrosse Picture")
        mySlides(2) = New AjaxControlToolkit.Slide("~/pics/DSC_1784.jpg", "pic3", "Third Lacrosse Picture")
        mySlides(3) = New AjaxControlToolkit.Slide("~/pics/DSC_1785.jpg", "pic4", "Fourth Lacrosse Picture")
        mySlides(4) = New AjaxControlToolkit.Slide("~/pics/DSC_1786.jpg", "pic5", "Fifth Lacrosse Picture")
 
        Return mySlides
    End Function
 
End Class

Open in new window

0
Comment
Question by:TeamEnova
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 18

Expert Comment

by:carlnorrbom
ID: 24094854
Hi,

The only obvious thing I can spot is that You're returning an Array with an upper bound of six (index based = 5) but only specifying the first five array fields (0->4). Maybe that breaks the extender? Try specifying at is MySlides(4) and see if it makes a difference.

/Carl.
0
 
LVL 2

Author Comment

by:TeamEnova
ID: 24096106
Here is something new.
If I put a break in the SlideService.vb file, at the Public Function GetSlides() line, it will go to that function, get into the function, but at the second line which is

mySlides(0) = New AjaxControlToolkit.Slide("~/pics/DSC_1782.jpg", "pic1", "First Lacrosse Picture")


It pops a box that says "Thre is no source code available for the current location."  What is that?
0
 
LVL 18

Expert Comment

by:carlnorrbom
ID: 24096680
Hi again,

Maybe You should not supply the dynamic path, try removing "~/" from the path. Sorry for being inaccurate but I'm actually on holiday over the easter and doesn't have access to my dev box. Also, since the error message reg. the source code most likely is related to the control toolkit, have You tried adding a reference to the Ajax ControlToolkit dll to the project containing the service (if not the same project as for the slideshow)?

/Carl.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 2

Author Comment

by:TeamEnova
ID: 24097207
carinorrbom,
I have tried your suggestion, but still no luck.  It is like the extender just doesnt work at all.  The first image, as supplied in the aspx file, does show up, but none of the buttons work, except that when I  hit the stop/play button, the text changes.  Thats it.

Very confusing.
0
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 500 total points
ID: 24099860
Hi again!

Three things:

1. The "There is no source ... " error is, as far as I can understand, a debugging "bug" in VS. It can't find the debugging symbols for the toolkit but the code actually works anyway.

2. I replicated Your code when I got access to my dev box and hey, guess what, didn't work. I changed two things compared to Your code:

2.1: In Your markup You had an error in the style attribute for the image, it hade broken out on two separate rows:

                   style="border:1px solid black;
                   width:auto"

Change it to one row:

                   style="border:1px solid black;width:auto;"

2.2: In the service code, change the image paths from "~/pics/.." to "pics/..". Other than that I imported the Toolkit namespace to clean things up a bit. I have attached the service code as well for Your reference.

With these changes, it builds and runs just fine on my dev box, hope it will on Yours too!

/Carl.
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports AjaxControlToolkit
 
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class SlideService
    Inherits System.Web.Services.WebService
 
    <WebMethod()> _
    Public Function GetSlides() As Slide()
        Dim MySlides(2) As Slide
        MySlides(0) = New Slide("pics/pic1.jpg", "Pic 1", "Pic 1")
        MySlides(1) = New Slide("pics/pic2.jpg", "Pic 2", "Pic 2")
        MySlides(2) = New Slide("pics/pic3.jpg", "Pic 3", "Pic 3")
        Return MySlides
    End Function
 
End Class

Open in new window

0
 
LVL 2

Author Closing Comment

by:TeamEnova
ID: 31567847
Great work.  Thanks for sticking with it, even through vacation!  I am a bit embarassed that I did not pick up those errors, but anyway, Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question