我試圖讀取包含圖像名稱的文本文件,並將其顯示爲opon pageload。將按鈕包含到.cs文件中
比方說,在文本文件中的內容是
Australia Picture101
Singapore Picture201
以下是我試過的代碼,它不顯示圖像。
tableString += "<table class='content_background' cellpadding='0' cellspacing='0'>";
foreach (string line in lines)
{
string[] country = line.Split(token2);
string[] image = country[1].Split(token);
string row = "<tr><td class='left_content'>" + country[0] + "</td>" +"<td><table><tr>";
tableString += row;
for (int i = 0; i < image.Length; i++)
{
---> string row2 = "<td class='right_content'> <asp:ImageButton ImageUrl='~/img/missing children pictures/" + "image[i]" + ".jpg'/>" + "</td>";
tableString += row2;
}
tableString += "</tr></table></td>";
}
tableString += "</tr></table>";
container.InnerHtml = tableString;
有沒有其他方法可以做到這一點?提前致謝。
的截屏如下
這不是ASP.NET如何工作,而是使用中繼器,或者如果您想要更多樣式,請嘗試ASP.NET MVC。 – leppie 2011-06-16 04:45:01