I have a drop down with list of doctors. What I would like to do is when you select on a name from the drop down list, to display a image.
The problem I am having is to search through the image folder and compare it with the name that was selected from the drop down.
Here is what I attempted to do below which does not work:
string imgPath = "\\AccessExpress\ASPCode\OCUpgrade52\images";
if(Directory.Exists(imgPath)){
string Name = Parameter_SelectName;//Contains the selection from drop down
if(File.Exists(Path.Combine(imgPath, Name)) )
Response.Write("true");
else
Response.Write("false");
}
else
Response.Write("false");
Getting the following error: CS1009: Unrecognized escape sequence
And having a hard time to grab the image that matches the selection to display
Update: I was able to resolve the issue with the following (I hope this helps others who are having similar issues):
Here is what i have so far:
string imgFolderPath = @"\\AccessExpress\ASPCode\OCUpgrade52\images";
bool folderExists = System.IO.Directory.Exists(imgFolderPath);
if(folderExists){
string urlPath = "http://oc2-reatest/OCUpgrade52/images/";
string imgName= Parameter_SelectName + ".png";
string img = string.Concat(urlPath,imgName);
bool fileExists = System.IO.File.Exists(System.IO.Path.Combine(imgFolderPath, imgName));
if(fileExists)
Response.Write("<img src='" + img + "' />");
else
Response.Write("File Does Not Exists");
}
else
Response.Write("Folder Does Not Exists");