I had tried many methods to show images on image slider of AJAX bt none of them are working. Please help in solving the error.
<asp:ToolkitScriptManager
ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Image ID="Image2" runat="server" Height="200px" Width="315px" />
<asp:SlideShowExtender ID="Image1_SlideShowExtender" runat="server"
TargetControlID="Image2" SlideShowServiceMethod="GetSlides"
SlideShowServicePath="WebService.asmx" PreviousButtonID="Button1" PlayButtonID="Button2"
NextButtonID="Button3" PlayButtonText="Play" StopButtonText="Stop" AutoPlay="true" Loop="true">
</asp:SlideShowExtender>
In Webservice.asmx.cs file
//Uncomment the following line if using designed components
//InitializeComponent();
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
string[] imagenames = System.IO.Directory.GetFiles(Server.MapPath("~/Pic"));
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("Pic/" + file[file.Length - 1], file[file.Length - 1], "");
}
return photos;
}
}
}
[System.Web.Script.Services.ScriptService]
Uncomment this line Your slideshow extender will start working
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.