title: How to Dynamically Add a PlaceHolder within a Panel in ASP
body: <p>I am trying to dynamically create a new textbox whenever a button is clicked. The page requirements are for a user to enter information in as many textboxes as they may need, so I can't just throw a set number of PlaceHolders onto the page, and then dynamically add controls to it. </p>
  
  <p>So far, I am able to add controls to a placeholder already on the page, but when I click my "Add Another" button, it just replaces that control with a new one, instead of adding it below it. </p>
  
  <p>I've tried various ways of approaching this, and this is currently where I'm at (in VB):</p>
  
  <pre><code>    'This is to be used in duplicating the PLO textbox within the panel
      Dim newTextboxPLO As New TextBox() 'make a new textbox
      Dim newLabelPLO As New Label() 'make a new label
      Dim plhNewPlaceHolder As New PlaceHolder() 'make a new place holder
      'Add a spacer
      Dim spacer As LiteralControl = New LiteralControl("&lt;br /&gt;")
  
      ploCounter += 1
  
      'New place holder attributes
      plhNewPlaceHolder.ID = "plhNewPlaceHolder" &amp; ploCounter
      'New textbox attributes
      newTextboxPLO.ID = "txtPLO" &amp; ploCounter
      newTextboxPLO.TextMode = TextBoxMode.MultiLine
      newTextboxPLO.Width = "318"
      newTextboxPLO.Height = "70"
  
      'New label attributes
      newLabelPLO.Text = (ploCounter) &amp; ") "
      newLabelPLO.Font.Bold = True
      newLabelPLO.ID = "lblPLO " &amp; (ploCounter)
  
      pnlAddPLO.Controls.Add(plhNewPlaceHolder)
      'If the original place holder has content in it, add the new textbox and label into a new placeholder
      If plhPLO.HasControls = False Then
          'Add new textbox and label into the placeholder
          plhPLO.Controls.Add(newLabelPLO)
          plhPLO.Controls.Add(newTextboxPLO)
          plhPLO.Controls.Add(spacer)
      Else
          'Add new placeholder into the panel
          pnlAddPLO.Controls.Add(plhNewPlaceHolder)
          'Add items into the new placeholder
          plhNewPlaceHolder.Controls.Add(newLabelPLO)
          plhNewPlaceHolder.Controls.Add(newTextboxPLO)
          plhNewPlaceHolder.Controls.Add(spacer)
          'Increase the place holder counter
          plhCounter += 1
      End If
  </code></pre>
  
  <p>I already checked out many questions, including <a href="https://stackoverflow.com/questions/24271028/add-placeholder-dynamically">this one</a>, but it didn't quite help. I feel like there's something small that I'm missing, but I'm not sure what.</p>