AJAX SlideshowExtender麻烦

时间:2012-12-16 03:03:41

标签: c# asp.net ajax asp.net-ajax ajaxcontroltoolkit

我无法让AJAX幻灯片扩展器工作。它不会旋转页面上的图像。奇怪的是,当它在浏览器中呈现并在那里旋转图像时,它会在页面底部的标签之外创建一个img标签,如下所示

<img style=" display:none;" src="the rotating images" />

虽然它不会在目标控件内提供或旋转图像。我的代码如下:

.aspx page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Slideshow.aspx.cs" Inherits="MirandasWebsite.Slideshow" %>

<%@ 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>Miranda's Slideshow</title>
<link href="Styles/Mir3.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="smSlideshow" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<div class="Images">
    <asp:Image ID="mySlideshow" runat="server" Height="250" Width="300"  />
</div>
<asp:SlideShowExtender ID="Slideshowextender1" runat="server" BehaviorID="SSBehaviorID"
    TargetControlID="mySlideshow" SlideShowServiceMethod="GetSlides" AutoPlay="true"
    NextButtonID="btnNext" PreviousButtonID="btnPrev" PlayButtonID="btnPlay" PlayButtonText="Play"
    StopButtonText="Stop" Loop="true">
</asp:SlideShowExtender>
<div id="slideshowDescription" runat="server">
</div>
<div class="centerControls">
<asp:Label ID="lblDesc" runat="server" Text=""></asp:Label><br />
<asp:Button ID="btnPrev" runat="server" Text="Previous" />
<asp:Button ID="btnPlay" runat="server" Text="" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
</div>
</form>
</body>
</html>

和代码隐藏

    [System.Web.Services.WebMethod]
    [System.Web.Script.Services.ScriptMethod]
    public static AjaxControlToolkit.Slide[] GetSlides()
    {
        DataTable table = SiteAccess.GetImages();
        AjaxControlToolkit.Slide[] imgSlide = new AjaxControlToolkit.Slide[table.Rows.Count];
        int i = 0;
        foreach (DataRow row in table.Rows)
        {
            imgSlide[i] = new AjaxControlToolkit.Slide(row["Full"].ToString(), String.Empty, String.Empty);
            i++;
        }

        return (imgSlide);
    }

有关为何发生这种情况的任何线索。我已经尝试了我能想到的所有内容,包括图像中的硬编码,但我仍然得到相同的结果。

0 个答案:

没有答案