Hi:
You can just use AJAX SlideShowExtender. Here's a sample (create a Web Application project and add a new asmx item to this project):
The aspx:
<asp:Image ID="Image1" runat="server" />
<cc1:SlideShowExtender PlayInterval="1000" TargetControlID="Image1" AutoPlay="true" Loop="true" ID="SlideShowExtender1" runat="server"
SlideShowServiceMethod="GetSlides" SlideShowServicePath="WebService.asmx">
</cc1:SlideShowExtender>
The asmx web service:
using System;
using System.Collections;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.IO;
/// <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
{
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
DirectoryInfo d = new DirectoryInfo(Server.MapPath("images"));
FileInfo[] fi = d.GetFiles();
ArrayList list = new ArrayList();
for (int i = 0; i < fi.Length; i++)
{
if (fi[i].Extension == ".jpg")
{
list.Add(fi[i].Name);
}
}
AjaxControlToolkit.Slide[] result = new AjaxControlToolkit.Slide[list.Count];
for (int i = 0; i < result.Length; i++)
{
result[i] = new AjaxControlToolkit.Slide("images/" + list[i].ToString(), i.ToString(), i.ToString());
}
return result;
}
public WebService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
And you need a directory called images under the root direcotory of the web site. Above code will work for all jpg images. You can modify the logic to meet your needs.
Regards