急!!!!动态生成控件的Click事件如何写
我用程序动态生成了一个ImageButton控件,现在想实现它的click事件
private void ShowImgs
{
ImageButton iBtnProduct = new ImageButton();
iBtnProduct.Width = 250;
iBtnProduct.Height = 200;
iBtnProduct.ImageUrl = strFile;
iBtnProduct.Click +=new System.Web.UI.ImageClickEventHandler(iBtnProduct_Click);
this.PanelImg.Controls.Add(iBtnProduct);
}
可是这段代码只有放在Page_Load()下才能执行,我想自己定义一个函数,动态生成imageButton控件,然后实现它的click事件,不知道该怎么做