如果我ImageButton
动态创建并将其添加到表格单元格中
TableRow tr = new TableRow();
TableCell tc = new TableCell();
ImageButton imagebutton= new ImageButton();
imagebutton.imageurl=imageurl;
imagebutton.click+= new System.Web.UI.ImageClickEventHandler(click);
tc.Controls.Add(imagebutton);
tr.Controls.Add(tc);
Table1.Rows.Add(tr);
点击事件不起作用。
但是,如果我使用Panel
而不是 tableimagebutton
作品。Morevoer 如果我page
直接将图像按钮添加到它也可以。但我需要存储imagebutton
在table cell
.
什么是问题?如何让工作imagebutton
在里面asp table
?
点击的方法是:
protected void click(object sender, EventArgs e)
{
Response.Write("<script type='text/javascript'>alert('OK!');</script>");
}