【发布时间】:2011-06-18 16:23:18
【问题描述】:
我有网络表单,我将图像(图像按钮)添加到表中,该表是在运行时从数据库中动态创建的...有一个静态图像,它会根据鼠标悬停在动态图像上而改变...
代码如下:
HtmlTable tbProductImage = new HtmlTable();
HtmlTableRow trImageRow = new HtmlTableRow();
for (int j = 0; j < columnCount; j++) {
if (filteredFileList.Count != 0) {
HtmlTableCell tdImageRow = new HtmlTableCell();
Panel panel = new Panel();
ImageButton btnProduct = new ImageButton();
btnProduct.ID = "btn" + filteredFileList[j].Name.Substring(0, filteredFileList[j].Name.LastIndexOf("."));
btnProduct.ImageUrl = @"/ysyp/Images/Products/" + filteredFileList[j].Name;
btnProduct.Width = 50;
btnProduct.CommandName = "Click";
Page.ClientScript.GetPostBackEventReference(btnProduct, "btnProduct_Click");
btnProduct.CommandArgument = filteredFileList[j].Name;
btnProduct.Click += new ImageClickEventHandler(btnProduct_Click);
panel.Controls.Add(btnProduct);
trImageRow.Cells.Add(tdImageRow);
tdImageRow.Controls.Add(panel);
}
}
tbProductImage.Rows.Add(trImageRow);
tdProduct.Controls.Add(tbProductImage);
我该怎么做...
谢谢...
【问题讨论】:
标签: c# image events mouseover imagebutton