Home.aspx
<table width="679" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Image ID="imgslides" runat="server" width="679" height="205"/>
</td>
</tr>
</table>
<ajax:SlideShowExtender runat="server" AutoPlay="true" ImageTitleLabelID="lblTitle" ImageDescriptionLabelID="lblimgdesc" Loop="true"
TargetControlID="imgslides" SlideShowServicePath="SlideshowH.asmx" SlideShowServiceMethod="GetSlides"></ajax:SlideShowExtender>
</div>
</td>
</tr>
</table>
SlideshowH.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/SlideshowH.cs" Class="SlideshowH" %>
SlideshowH.cs
using System;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class SlideshowH : System.Web.Services.WebService {
public SlideshowH () {
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["shoppe"].ConnectionString);
SqlCommand cmd = new SqlCommand();
SqlDataAdapter adap = new SqlDataAdapter();
DataSet ds;
cmd = new SqlCommand("select substring(image,4,1000)as image from tbl_panner where page='Home'", con);
adap = new SqlDataAdapter(cmd);
ds = new DataSet();
adap.Fill(ds);
string[] imagenames = System.IO.Directory.GetFiles(Server.MapPath("~/Upload"));
AjaxControlToolkit.Slide[] photos = new AjaxControlToolkit.Slide[ds.Tables[0].Rows.Count];
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string[] file = imagenames[i].Split('\\');
photos[i] = new AjaxControlToolkit.Slide(ds.Tables[0].Rows[i]["image"].ToString(),"", "");
}
return photos;
}
}