title: How can I create an asp:button iteratively in code behind aspx file?
body: <p>So essentially I am making a "cart" for a website I am doing as an extra side project.  In each item in cart, I am attempting to put a button to remove the item from the cart.  The issue is, it is not possible to create an asp:button from the code behind.  Everything I have read says to make a placeholder or panel and then put a button inside that, but since I wont know how many items the user has in their cart, I cant just put X amount of placeholders in my aspx file.</p>
  
  <p>My aspx code (so far):</p>
  
  <pre><code>&lt;asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"&gt;
  
      &lt;div id="emptyCart" style="text-align: center;" runat="server"&gt;
          &lt;h1&gt;Your cart is empty!&lt;/h1&gt;
      &lt;/div&gt;
  
      &lt;div id="cart" runat="server"&gt;
  
  
  
      &lt;/div&gt;
  
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>My background writing for making the items appear in cart (this would be for just 1 item):</p>
  
  <pre><code>                    if (cart.InnerHtml == "")
                      {
                          cart.InnerHtml = "&lt;div class='jumbotron'&gt;";
                      }
                      else
                      {
                          cart.InnerHtml += "&lt;div class='jumbotron'&gt;";
                      }
                      cart.InnerHtml += "&lt;div style='display:block;'&gt;";
                      cart.InnerHtml += "&lt;h3 style='display:inline-block'&gt;Featured&lt;/h3&gt;";
                      cart.InnerHtml +=  "&lt;h4 style = 'display:inline-block; float:right;' &gt; Special title treatment&lt;/h4&gt;";
                      cart.InnerHtml += "&lt;/div&gt;";
                      cart.InnerHtml += "&lt;div&gt;";
                      cart.InnerHtml += "&lt;h6&gt;With supporting text below as a natural lead-in to additional content.&lt;/h6&gt;";
                      cart.InnerHtml += "&lt;asp:Button id='remove' Text='Remove' runat='server' OnClick='Remove_Click' class='btn btn-primary btn-lg'&gt;&lt;/asp:Button&gt;";
                      cart.InnerHtml += "&lt;/div&gt;";
                      cart.InnerHtml += "&lt;/div&gt;";
  </code></pre>
  
  <p>How can I make an asp:button or an equivalent feature from the code behind when I don't know how many I am going to need?</p>