Output:
Aspx Page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div style="width:200px">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Image ID="img1"
runat="server"
Height="150px"
Width="200px"
ImageUrl="~/images/pic1.jpg" />
<asp:SlideShowExtender ID="SlideShowExtender1" runat="server"
BehaviorID="SlideShowBehaviorID"
TargetControlID="img1"
SlideShowServiceMethod="GetImagesForSlide"
AutoPlay="true"
ImageDescriptionLabelID="lblDesc"
NextButtonID="btnNext"
PreviousButtonID="btnPrev"
PlayButtonID="btnPlay"
PlayButtonText="Play"
StopButtonText="Stop"
Loop="true" >
</asp:SlideShowExtender>
</div>
<div style="width:200px">
/*Description about the image will be shown in this Label*/
<asp:Label ID="lblDesc" runat="server" Text=""></asp:Label><br />
/*Previous, Next Button to see the previous, next image and Play and stop button to start and stop the slide show */
<asp:Button ID="btnPrev" runat="server" Text="Previous" />
<asp:Button ID="btnPlay" runat="server" Text="" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
</div>
</div>
</form>
</body>
</html>
Aspx.cs Page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetImagesForSlide()
{
AjaxControlToolkit.Slide[] imgSlide = new AjaxControlToolkit.Slide[4];
/*Provide some images for slide show*/
imgSlide[0] = new AjaxControlToolkit.Slide("images/pic1.jpg", "Flower", "Flower");
imgSlide[1] = new AjaxControlToolkit.Slide("images/pic2.jpg", "City", "Atlanta");
imgSlide[2] = new AjaxControlToolkit.Slide("images/pic3.jpg", "Picture", "Imagine");
imgSlide[3] = new AjaxControlToolkit.Slide("images/pic4.png", "Team Logo", "Logo");
return (imgSlide);
}
}
No comments:
Post a Comment