title: how to use an ImageButton.OnClick if the ImageButton was created in code behind
body: <p>I created an ImageButton in code behind. Now I need that when a client press the ImageButton, the ImageButton will do a certain function. The problem is that it doesn't do this certain function.</p>
  
  <p>this is the code-</p>
  
  <pre><code>var img = new ImageButton();
  img.ID = "Del" + i.ToString();
  img.ImageUrl = "images/1395958363_meanicons_57.png";
  img.Width = 48;
  img.Height = 38;
  img.Click += new System.Web.UI.ImageClickEventHandler(this.btnForDelete_Click); //doesn't work!!
  
  Lab.Controls.Add(img); //put the image in a label
  </code></pre>