How Do I: Use the ASP.NET AJAX SlideShow Extender?

This video demonstrates how the SlideShow extender from the ASP.NET AJAX Control Toolkit turns the standard ASP.NET Image control in to a fully-functional slide show. We also see how an ASP.NET Web service can return not only text and XML data but complete AJAX objects to be consumed by the ASP.NET AJAX Web application. Joe also comments on the benefits of storing images in the file system rather than the database.

Presented by Joe Stagner

Duration: 19 minutes, 27 seconds

Date: 9 July 2007

Watch the video   |   Download the video   |   Get VB code  or  C# code

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 16

Leave a Comment

Nezdet : On March 20, 2008 8:14 AM said:

This is a good sample. I have used it in my webbapplication.. Thanks

It would be greate if the pictures should be displayed in thumbnails... and if I want a specifik image to be displayed, I click on it.

Nezdet : On March 20, 2008 8:17 AM said:

Hi Joe

This video is good. But I would like to display the pictures in thumbnails and when I click on a picture the picture should be displayed

JoeStagner : On March 25, 2008 2:34 PM said:

The control doesn't do that but as mentioned in response to one of your other comments, since the control is open source you can modify the control to do whatever you need.

stefjnl : On April 01, 2008 9:23 AM said:

the C# code doesnt seem to contain the SlidesService.cs file? Thanks for all the great video's!

hs_jha : On April 23, 2008 11:32 AM said:

Joe I have been following all your videos .I wanna know if it is possible to show some data along with photos as slide show ?

gtk : On May 14, 2008 10:11 AM said:

I think the C# version of the .zip file doesnt contain the web service.

Also, if you have the following error message when viewing the page on the browser "unknown web method getslides...", then you have to remove the static keyword from the GetSlides() function. After this change, it worked OK for me!

In any case, check the vb.net version that works fine

FoothillsData : On May 27, 2008 12:28 PM said:

When I download and run the VB code example, it get Microsoft JScript runtime error: Sys.InvalidOperationException: Can't add a handler for the error event using this method.  Please set the window.onerror property instead.  This also happens when I try to run this example on my Godaddy.com site.  Any ideas?  Thanks!

erockmurray : On May 27, 2008 6:25 PM said:

Anyone ever successfully used this control on a secure/Windows Auth site, or in SharePoint using Windows Auth?  I can't figure out a way to pass the default credentials of the currently authenticated user via the control.  I get everything to work right up to the web service call.  I can verify that the web service works fine, it's an authentication issue.  I've looked at the javascript created by the call and I don't see anything in there or in the properties of the control to set credentials.  Is this only to be used for anonymous and public facing websites?  The full details of my scenario are here: forums.asp.net/.../1265300.aspx

Any ideas?  I'm not having any luck figuring this out anywhere on the interweb.

Thanks!

group9a : On June 04, 2008 7:51 AM said:

Hello everyone. Joe sorry this question is aimed at you. I have recently downloaded the 2008 visual web developer edition and tried running the example you recorded on it but it keeps bringing up errors especially when i begin to type AjaxControlToolkit.Slides. Do you know why and how to fix this?

JoeStagner : On June 04, 2008 5:08 PM said:

The script errors happen becuase you are trying to use the 1.0 version of the toolkit with the 3.5 version of the framework.

Replace the Toolkit assembly in the Bin directory with the correct version and the code should run fine.

HTH !

geoffk : On June 07, 2008 5:12 PM said:

Is it possible to change the SlideShow so that the image and/or the text are Links?

Wardgp : On June 09, 2008 4:52 PM said:

Hey Joe,

This one works great using the script C# as you have it set in solution instead of a web service.  I then went to try to do it using the web service like you built in the video and could not bring up the photos.  I'm setting the SlideShowServicePath="SlidesService.asmx" and the project builds clean, but still no luck.  Any Ideas??

bryiantan : On June 10, 2008 12:05 PM said:

same here, not working with web services in c# but works fine in vb.net. Joe, please show us the code for SlidesService.cs

bryiantan : On June 11, 2008 11:30 AM said:

hi, i figured it out, we should include [System.Web.Script.Services.ScriptService], remove the static and everything remain the same. This will take care of the error "unknown web method GetSlides..." here is a sample for SlidesService.cs:

using System;

using System.Web;

using System.Collections;

using System.Web.Services;

using System.Web.Script.Services;

using System.Web.Services.Protocols;

using System.Configuration;

using System.Web.UI.WebControls;

using System.Web.UI;

/// <summary>

/// Summary description for SlidesService

/// </summary>

[WebService(Namespace = "http://tempuri.org/")]

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

[System.Web.Script.Services.ScriptService]

public class SlidesService : System.Web.Services.WebService {

   public SlidesService () {

       //Uncomment the following line if using designed components

       //InitializeComponent();

   }

   [System.Web.Services.WebMethod]    

   public AjaxControlToolkit.Slide[] GetSlides()

   {

       System.Web.UI.WebControls.SqlDataSource ds = new SqlDataSource();

       ds.ConnectionString = ConfigurationManager.ConnectionStrings["pictureConnectionSt ring"].ConnectionString;

       string testConn = ConfigurationManager.ConnectionStrings["pictureConnectionSt ring"].ConnectionString;

       string mySelect;

       int count = 0;

       mySelect = "SELECT TOP 20 * FROM [pictureName] ORDER BY NEWID()";

       ds.SelectCommand = mySelect;

       System.Data.DataView dv = (System.Data.DataView)ds.Select(new DataSourceSelectArguments());

       count = dv.Table.Rows.Count;

       AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[count];

       try

       {

           for (int i = 0; i < count; i++)

           {

               slides[i] = new AjaxControlToolkit.Slide("images/" + dv.Table.Rows[i]["path"].ToString(),

                                                                    dv.Table.Rows[i]["name"].ToString(),

                                                                    dv.Table.Rows[i]["description"].ToString());

           }

       }

       catch { }

       //slides[0] = new AjaxControlToolkit.Slide("images/Blue hills.jpg", "Blue Hills", "Go Blue");

       //slides[1] = new AjaxControlToolkit.Slide("images/Sunset.jpg", "Sunset", "Setting sun");

       //slides[2] = new AjaxControlToolkit.Slide("images/Winter.jpg", "Winter", "Wintery...");

       //slides[3] = new AjaxControlToolkit.Slide("images/Water lilies.jpg", "Water lillies", "Lillies in the water");

       //slides[4] = new AjaxControlToolkit.Slide("images/VerticalPicture.jpg", "Sedona", "Portrait style picture");

       return (slides);

   }

}

thenab : On June 19, 2008 12:10 PM said:

Hi Joe

I hope you still monitor this. First of all a great video. I remember programming using ASP, then ASP.NET 1.0. Then I stopped development for some time. Coming back to the web development now, the progress has been revolutionary. These things were almost unthinkable back then. I would like to know whether there is any possibility to display pictures and also play videos based on the contents of a particular directory. I think this is not possible with this control but is there any other alternative. Thanks a lot and keep up the great work.

Regards,

Nabil

eerunee : On June 25, 2008 3:11 PM said:

Joe;

I've watched you video and downloaded the codes, but when I try to type the code, the application complains about "<ajaxToolKit:ToolKitScriptManager ID="ScriptManager1" runat="server" />" tag to be invalid. I am trying to incorporate this new technique into my existing asp.net website. Am I missing something?

Thanks

Ramin

Leave a Comment

You must be logged in to leave a comment. Click here to log in.