Ajax static method in master page RRS feed

  • Question

  • User1078715821 posted

    I have below coding to show a slideshow in MasterPage

    <asp:Panel ID="Panel5" runat="server" Width="700px" Height="150px">
        <asp:Image runat="server" ID="img" Width="700px" Height="150px" />
        <asp:SlideShowExtender ID="SlideShowExtender5" runat="server" SlideShowServiceMethod="GetSlides" TargetControlID="img" UseContextKey="True"></asp:SlideShowExtender>

    To where I can add this GetSlides() static method in master page? Because it gives an runtime error always method is not available.

    Saturday, April 12, 2014 7:40 PM


  • User-1818759697 posted


    You could add one new webservice page to your application and give name as Slideshow.asmx, then add the GetSlides method into the web services(.asmx) file:

    public class Slideshow : System.Web.Services.WebService {
    public Slideshow () {
    //Uncomment the following line if using designed components 
    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;

    For detailed information, you could refer to:



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 14, 2014 4:09 AM

All replies