Here I will explain how to solve the problem Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'GetSlides' failed with the following error: during use of Ajax Slideshow extender control to display images from root folder using asp.net
Description:
[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public AjaxControlToolkit.Slide[] GetSlides() { …… …… } |
[System.Web.Script.Services.ScriptService] |
/// <summary> /// Summary description for Slideshow /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class Slideshow : System.Web.Services.WebService { public Slideshow () { //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("~/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; } } |
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
Subscribe by RSS
Subscribe by Email
5 comments :
I have done as you suggested but still I am getting the error.
I am trying load the user control dynamically. User control has lot of complex code Repeater inside repeater so many action button.
your codes helped more... thankyou
its still giving same error..
plz help me to solve it!
The error problem still exist.
I can not find the differences.