Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
i want to pass parametre to my methode ( the paramtre is the path off my directory off picture)
this's my code

XML
<asp:Image ID="Image1" runat="server" Height="300" Width="300" />
           <cc1:SlideShowExtender ID="SlideShowExtender" runat="server" TargetControlID="Image1"
               SlideShowServiceMethod="GetImages" ImageTitleLabelID="lblImageTitle" ImageDescriptionLabelID="lblImageDescription"
               AutoPlay="true" Loop="true" PlayButtonID="btnPlay" StopButtonText="Stop"
               PlayButtonText="Play" NextButtonID="btnNext" PreviousButtonID="btnPrevious">
           </cc1:SlideShowExtender>



C#
[WebMethod]
[ScriptMethod]
public static Slide[] GetImages()
{
    List<slide> slides = new List<slide>();
    string path = HttpContext.Current.Server.MapPath("~/images/");
    if (path.EndsWith("\\"))
    {
        path = path.Remove(path.Length - 1);
    }
    Uri pathUri = new Uri(path, UriKind.Absolute);
    string[] files = Directory.GetFiles(path);
    foreach (string file in files)
    {
        Uri filePathUri = new Uri(file, UriKind.Absolute);
        slides.Add(new Slide
        {
            ImagePath = pathUri.MakeRelativeUri(filePathUri).ToString()
        });
    }
    return slides.ToArray();
}



i want to pass paramtre to my function GetImages
by the way this code i have download it
and thanks
Posted
Updated 4-Jun-15 3:35am
v2
Comments
[no name] 4-Jun-15 11:33am    
You can get some idea from below link, check if this helps.

http://www.aspsnippets.com/Articles/ASPNet-AJAX-AutoCompleteExtender-Pass-Additional-Parameter-to-WebMethod-using-ContextKey.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900