我按照这个链接的教程Ajax Slide show extender
我的代码如下
<div>
<table style="border:Solid 3px #D55500; width:400px; height:400px" cellpadding="0"
cellspacing="0">
<tr style="background-color:#D55500">
<td style=" height:10%; color:White; font-weight:bold; font-size:larger"
align="center">
<asp:Label ID="lblTitle" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Image ID="imgslides" runat="server" Height="400px" Width="400px" />
</td>
</tr>
<tr>
<td align="center">
<asp:Label ID="lblimgdesc" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btnPrevious" runat="server" Text="Prev" CssClass="button" />
<asp:Button ID="btnPlay" runat="server" Text="Play" CssClass="button" />
<asp:Button ID="btnNext" runat="server" Text="Next" CssClass="button" />
</td>
</tr>
</table>
<ajax:SlideShowExtender runat="server" AutoPlay="true" ImageTitleLabelID="lblTitle"
ImageDescriptionLabelID="lblimgdesc" Loop="true"
NextButtonID="btnNext" PreviousButtonID="btnPrevious" PlayButtonID="btnPlay"
PlayButtonText="Play" StopButtonText="Stop"
TargetControlID="imgslides" SlideShowServicePath="Slideshow.asmx"
SlideShowServiceMethod="GetSlides"></ajax:SlideShowExtender>
在我的网络服务中我有一个文件
[WebMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
string[] ImageNames = System.IO.Directory.GetFiles(Server.MapPath(@"C:\Users\Mayer\Documents\Visual Studio 2010\Projects\Project1\Project1\Images\"));
AjaxControlToolkit.Slide[] photos = new AjaxControlToolkit.Slide[ImageNames.Length];
for (int i = 0; i < ImageNames.Length; i++)
{
string[] file = ImageNames[i].Split('\\');
photos[i] = new AjaxControlToolkit.Slide("Images/" + file[file.Length - 1], file[file.Length - 1], "");
}
return photos;
}
我有图像文件夹,但看不到幻灯片
请帮忙