I can't figure out why this line of code
Image1.ImageUrl = displayPath + photoFileList[index].ToString();
works in the Button1 click event but not in the btnNext click event (after clicking button1 to load the data).
if i comment out the line in button1 it won't work in btnNext after clicking button1
public List<string> photoFileList = new List<string>();
public int index = 0;
public string loadPath = "\\\\intranet.org\\Photo Album\\Employees\\";
public string displayPath = "////intranet.org//Photo Album//Employees//";
protected void Button1_Click(object sender, EventArgs e)
{
DirectoryInfo di = new DirectoryInfo(loadPath);
FileInfo[] rgFiles = di.GetFiles("*.JPG");
foreach (FileInfo fi in rgFiles)
{
photoFileList.Add(fi.Name);
}
// this next line works here if i uncomment it but it won't work in btnNext click
//Image1.ImageUrl = displayPath + photoFileList[index].ToString();
}
protected void btnNext_Click(object sender, EventArgs e)
{
Image1.ImageUrl = displayPath + photoFileList[index].ToString();
}