Hi micah,
Refering the below article i have created sample that full fill your requirement.
HTML
<%@ 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></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
table
{
border: 1px solid #ccc;
}
table th
{
background-color: #F7F7F7;
color: #333;
font-weight: bold;
}
table th, table td
{
padding: 5px;
border-color: #ccc;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<div>
<table>
<tr>
<td>
<asp:Button ID="btnPrevious" runat="server" Text="<<" />
</td>
<td>
<asp:Image ID="Image1" runat="server" Height="100" Width="100" />
<cc1:SlideShowExtender ID="SlideShowExtender" runat="server" TargetControlID="Image1"
SlideShowServiceMethod="GetImages" AutoPlay="false" Loop="true" NextButtonID="btnNext"
PreviousButtonID="btnPrevious">
</cc1:SlideShowExtender>
</td>
<td>
<asp:Button ID="btnNext" runat="server" Text=">>" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
C#
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetImages()
{
List<AjaxControlToolkit.Slide> slides = new List<AjaxControlToolkit.Slide>();
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString);
SqlCommand cmd = new SqlCommand("SELECT ImageId,ImageUrl FROM ImageSlider", con);
con.Open();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
con.Close();
foreach (DataRow dr in dt.Rows)
{
slides.Add(new AjaxControlToolkit.Slide
{
Name = dr["ImageId"].ToString(),
Description = dr["ImageId"].ToString(),
ImagePath = dr["ImageUrl"].ToString()
});
}
return slides.ToArray();
}
VB.Net
<System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetImages() As AjaxControlToolkit.Slide()
Dim slides As New List(Of AjaxControlToolkit.Slide)()
Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings(1).ConnectionString)
Dim cmd As New SqlCommand("SELECT ImageId,ImageUrl FROM ImageSlider", con)
con.Open()
Dim dt As New DataTable()
Dim da As New SqlDataAdapter(cmd)
da.Fill(dt)
con.Close()
For Each dr As DataRow In dt.Rows
slides.Add(New AjaxControlToolkit.Slide() With { _
.Name = dr("ImageId").ToString(), _
.Description = dr("ImageId").ToString(), _
.ImagePath = dr("ImageUrl").ToString() _
})
Next
Return slides.ToArray()
End Function
Screenshot