我试图将图像添加到动态表,但它不会发生...... 还当我添加图片到细胞中有一个错误信息:添加图片到HTML表格动态
由于内容不是文字,无法获取内容。
if (filteredFileList.Count != 0 && filteredFileList != null) {
imgProduct.ImageUrl = Server.MapPath(@"/ysyp/Images/Products/") + filteredFileList[0].Name;
rowCount = 1;
columnCount = filteredFileList.Count;
try {
HtmlTable tbProductImage = new HtmlTable();
HtmlTableRow trImageRow = new HtmlTableRow();
for (int j = 0; j < columnCount; j++) {
if (filteredFileList.Count != 0) {
HtmlTableCell tdImageRow = new HtmlTableCell();
Image imageProduct = new Image();
imageProduct.ID = "img" + filteredFileList[j].Name.Substring(0, filteredFileList[j].Name.LastIndexOf("."));
imageProduct.ImageUrl = Server.MapPath(@"/ysyp/Images/Products/") + filteredFileList[j].Name;
tdImageRow.Controls.Add(imageProduct);
trImageRow.Controls.Add(tdImageRow);
}
}
tbProductImage.Controls.Add(trImageRow); // <<< ERROR HERE
tdProduct.Controls.Add(tbProductImage);
} catch (Exception exc) {
string msg = exc.Message;
}
}
我怎样才能解决这个问题?
4492

被折叠的 条评论
为什么被折叠?



