title: WebUserControl Button Click
body: <p>I have a webusercontrol ( MiniUrunControl.ascx ) and in this webusercontrol I add a button and button click function is imgButtonMini_Click.
      </p>
  
  <pre><code>protected void imgButtonMini_Click(object sender, ImageClickEventArgs e)
  {
      DataTable _tablo = (DataTable)Session["KULLANICISEPETI"];
      foreach (DataRow _row in _tablo.Rows)
      {
          if (_row["urunid"].ToString() == lbUrunID.Text)
          {
              _tablo.Rows.Remove(_row);
              Session["KULLANICISEPETI"] = _tablo;
              break;
          }
      }
  
      this.Page.GetType().InvokeMember("ShowSepetBilgisi",
          System.Reflection.BindingFlags.InvokeMethod, null, this.Page, new object[] { });
  
  }
  </code></pre>
  
  <p>Now, I add a panel control in Default.aspx and Default.aspx CodeBehind like this;</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
    if(ispostback==false) ShowSepetBilgisi();
  }
  
  public void ShowSepetBilgisi()
  { 
      DataTable _tablo = (DataTable)Session["KULLANICISEPETI"];
  
      if (_tablo == null) return;
  
      pnlMiniUrunler.Controls.Clear();
  
      foreach (DataRow _row in _tablo.Rows)
      {
          MiniUrunControl _mini = (MiniUrunControl)LoadControl("MiniUrunControl.ascx");
          _mini.SetInfo(_row["urunid"].ToString(), _row["adet"].ToString());
          pnlMiniUrunler.Controls.Add(_mini);
      }
  }
  </code></pre>
  
  <p>Ok When run web site , I see all my products ( 10 webusercontrols in panel ) which are added in panel Control. But When I click imgButtonMini button , All control gone and panel is empty. Also my Button Click function doesnot works.</p>
  
  <p>Can you help me what is the problem and How can I run button function ? 
  Thanks</p>