title: Dynamically create a ASP.net Submit LinkButton using a Panel
body: <p>I am trying to implement an application which will dynamically create a list with a button next to each item on that list.  I am partially able to do this using the Panel control in the aspx page and adding html dynamically in the code behind.  I am having problems adding the LinkButton dynamically which will do database work based on which ID it is.  Is this even possible with what I have?:</p>
  
  <p>aspx:</p>
  
  <pre><code>&lt;asp:Panel ID="ItemPanel" runat="server"&gt;
  &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>code behind:</p>
  
  <pre><code>...
  StringBuilder sb = new StringBuilder();
  string UserID;
  
  while (dr.Read())
  {
      UserID = Convert.ToInt32(dr["UserID"]);
      sb.Append("&lt;div&gt;&lt;b class='template'&gt;&lt;/b&gt;");
      //Create LinkButton with event and code behind function
  }
  
  ItemPanel.Controls.Add(new LiteralControl(sb.ToString()));
  </code></pre>