动态生成imageButton 并指定事件

System.Web.UI.WebControls.ImageButton   ImageBox   =   new   System.Web.UI.WebControls.ImageButton();  
  ImageBox.ImageUrl="upimage/"+   r1["imagepath"].ToString();  
  ImageBox.ID   =   "xxx";  
  ImageBox.Click   +=new     System.Web.UI.ImageClickEventHandler(aa);  
   
   
  private   void   aa(object   sender,   System.Web.UI.ImageClickEventArgs   E)  
  {  
      ImageButton   ib   =   (ImageButton)sender;  
      if   (ib.ID   ==   "xxx")  
        ....  
      //  
  }  

原文地址:https://www.cnblogs.com/pchgo/p/1419788.html