Sir, I am Getting an error when using:-
string[] imageName = System.IO.Directory.GetFiles(Server.MapPath("/Photos"));
Getting error that : An object reference is required for the non-static field, method, or property 'System.Web.UI.Page.Server.get'
Why getting this error, is the lack of namespace or reference?
Loading


Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 4, 2013, 9:27 PM EDT
check this attached sample. if any doubt reply.
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 4, 2013, 9:01 PM EDT
plz provide more details. what actually you want. plz share code.
Bineesh ViswanathRank #1,681 · 907 reputationPosted Sep 4, 2013, 9:12 PM EDT
I want the function of Images being Slided.
My program is running, but no images is showing.
Here the html code for the SlideShowExtender.
TargetControlID="imgslides" SlideShowServicePath="~/Photos/" SlideShowServiceMethod="GetSlides">
and the .aspx.cs code:-
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] Slide()
{
string[] imageName = System.IO.Directory.GetFiles("~/Photos/");
AjaxControlToolkit.Slide[]photos=new AjaxControlToolkit.Slide[imageName.Length];
for (int i = 0; i < imageName.Length; i++)
{
string[] fileName = imageName[i].Split('\\');
photos[i] = new AjaxControlToolkit.Slide("Photos/" + fileName[fileName.Length - 1], fileName[fileName.Length - 1], "");
}
return photos;
}
The Image Folder is a folder I created(SolutionExplorer->New Folder(named it Photos)->add existing items(added images to it)
Bineesh ViswanathRank #1,681 · 907 reputationPosted Sep 4, 2013, 9:49 PM EDT
The file you given is working perfectly.
Bineesh ViswanathRank #1,681 · 907 reputationPosted Sep 4, 2013, 10:45 PM EDT
My program is being worked by adding the SlideShow.cs and SlideShow.asmx.
How can get this files, what are they?
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 4, 2013, 10:47 PM EDT
these are webservice files. you can get it by adding new item of webservice in your project.