Я не могу понять, почему эта строка кода
Image1.ImageUrl = displayPath + photoFileList[index].ToString();
работает в событии щелчка Button1, но не в событии щелчка btnNext (после нажатия кнопки 1 для загрузки данных).
если я закомментирую строку в button1, она не будет работать в btnNext после нажатия 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();
}