SlideShowExtender制作相册
前台代码:
Code
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<div class="title">SlideShow扩展器控件测试区</div>
<div style="text-align:center">
<asp:Label runat="Server" ID="imageTitle" CssClass="slideTitle"/><br />
<asp:Image ID="Image1" runat="server"
Height="300" Width="250px"
Style="border: 1px solid black;width:auto"
ImageUrl="~/images/Blue hills.jpg"
AlternateText="Blue Hills image" />
<asp:Label runat="server" ID="imageDescription" CssClass="slideDescription"></asp:Label><br /><br />
<asp:Button runat="Server" ID="prevButton" Text="Prev" Font-Size="Larger" />
<asp:Button runat="Server" ID="playButton" Text="Play" Font-Size="Larger" />
<asp:Button runat="Server" ID="nextButton" Text="Next" Font-Size="Larger" />
<ajaxToolkit:SlideShowExtender ID="slideshowextend1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
AutoPlay="true"
ImageTitleLabelID="imageTitle"
ImageDescriptionLabelID="imageDescription"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true" />
</div>
</form>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<div class="title">SlideShow扩展器控件测试区</div>
<div style="text-align:center">
<asp:Label runat="Server" ID="imageTitle" CssClass="slideTitle"/><br />
<asp:Image ID="Image1" runat="server"
Height="300" Width="250px"
Style="border: 1px solid black;width:auto"
ImageUrl="~/images/Blue hills.jpg"
AlternateText="Blue Hills image" />
<asp:Label runat="server" ID="imageDescription" CssClass="slideDescription"></asp:Label><br /><br />
<asp:Button runat="Server" ID="prevButton" Text="Prev" Font-Size="Larger" />
<asp:Button runat="Server" ID="playButton" Text="Play" Font-Size="Larger" />
<asp:Button runat="Server" ID="nextButton" Text="Next" Font-Size="Larger" />
<ajaxToolkit:SlideShowExtender ID="slideshowextend1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
AutoPlay="true"
ImageTitleLabelID="imageTitle"
ImageDescriptionLabelID="imageDescription"
NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
PlayButtonID="playButton"
Loop="true" />
</div>
</form>
后台代码:
Code
using AjaxControlToolkit;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
return new AjaxControlToolkit.Slide[] {
new AjaxControlToolkit.Slide("images/Blue hills.jpg", "Blue Hills", "<a href='http://www.baidu.com'>Go Blue</a>"),
new AjaxControlToolkit.Slide("images/Sunset.jpg", "Sunset", "Setting sun"),
new AjaxControlToolkit.Slide("images/Winter.jpg", "Winter", "Wintery"),
new AjaxControlToolkit.Slide("images/Water lilies.jpg", "Water lillies", "Lillies in the water"),
new AjaxControlToolkit.Slide("images/VerticalPicture.jpg", "Sedona", "Portrait style picture")};
}
}
using AjaxControlToolkit;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
return new AjaxControlToolkit.Slide[] {
new AjaxControlToolkit.Slide("images/Blue hills.jpg", "Blue Hills", "<a href='http://www.baidu.com'>Go Blue</a>"),
new AjaxControlToolkit.Slide("images/Sunset.jpg", "Sunset", "Setting sun"),
new AjaxControlToolkit.Slide("images/Winter.jpg", "Winter", "Wintery"),
new AjaxControlToolkit.Slide("images/Water lilies.jpg", "Water lillies", "Lillies in the water"),
new AjaxControlToolkit.Slide("images/VerticalPicture.jpg", "Sedona", "Portrait style picture")};
}
}