问题描述
网络服务文件
[System.Web.Script.Services.ScriptService]
[系统.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide [] GetSlides()
{
AjaxControlToolkit.Slide [] slides = new AjaxControlToolkit.Slide [3];
slides [0] = new AjaxControlToolkit.Slide(12.jpg, Image1,a);
slides [1] = new AjaxControlToolkit.Slide(37.jpg,Image1,a);
slides [2] = new AjaxControlToolkit.Slide(38l.jpg,Image1,a);
返回(幻灯片);
}
C#代码
< ajaxToolkit:ToolkitScriptManager ID =ToolkitScriptManager1runat = server>
< asp:图片ID =Image1runat =server/>
< asp:按钮ID =Button1Text =<<< runat =server/>
< asp:Button ID =Button2Text =<<<< runat =server/>
< asp:按钮ID =Button3Text =<<< runat =server/>
< ajaxToolkit:SlideShowExtender ID =SlideShowExtender1runat =server
TargetControlID =Image1
SlideShowServiceMethod =GetSlides
SlideShowServicePath =〜/ Service.asmx
PreviousButtonID =Button1
PlayButtonID =Button2
NextButtonID =Button3
PlayButtonText =Play
StopButtonText =停止
AutoPlay =true>
Web Service file
[System.Web.Script.Services.ScriptService]
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.Slide[] slides=new AjaxControlToolkit.Slide[3];
slides[0]=new AjaxControlToolkit.Slide("12.jpg", "Image1", "a");
slides[1]=new AjaxControlToolkit.Slide("37.jpg", "Image1", "a");
slides[2]=new AjaxControlToolkit.Slide("38l.jpg", "Image1", "a");
return (slides);
}
C# code
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<asp:Image ID="Image1" runat="server" />
<asp:Button ID="Button1" Text="<<<" runat="server" />
<asp:Button ID="Button2" Text="<<<" runat="server" />
<asp:Button ID="Button3" Text="<<<" runat="server" />
<ajaxToolkit:SlideShowExtender ID="SlideShowExtender1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
SlideShowServicePath="~/Service.asmx"
PreviousButtonID="Button1"
PlayButtonID="Button2"
NextButtonID="Button3"
PlayButtonText="Play"
StopButtonText="Stop"
AutoPlay="true">
这篇关于对于以下代码,我收到了Expected类,委托或结构的编译器错误。请帮忙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!