title: Dynamically add a new text box on button click
body: <p>I have textbox "tb1" on my page and I want users to be able to add another if they need to input more data. I have the following code:</p>
  
  <p><strong>VB:</strong></p>
  
  <pre><code>ViewState("num") = 2            
  Dim MyTextBox = New TextBox
  MyTextBox.ID = "tb" &amp; ViewState("num")
  MyTextBox.Width = 540
  MyTextBox.Height = 60
  MyTextBox.TextMode = TextBoxMode.MultiLine
  AddScript.Controls.Add(MyTextBox)
  AddScript.Controls.Add(New LiteralControl("&lt;br&gt;"))
  ViewState("num") = ViewState("num") + 1
  </code></pre>
  
  <p><strong>ASP:</strong></p>
  
  <pre><code>&lt;asp:PlaceHolder id="AddScript" runat="server"&gt;
      &lt;asp:Label ID="Label2" runat="server" Font-Bold="true" 
          Text="Scripts: (Drag from right)"&gt;&lt;/asp:Label&gt;&lt;br /&gt;
      &lt;asp:TextBox ID="tb1" runat="server" Width="90%" Height="60px" 
          TextMode="MultiLine" Enabled="false"&gt;&lt;/asp:TextBox&gt;
  &lt;/asp:PlaceHolder&gt;
  </code></pre>
  
  <p>My problem is that I can only add one text box each time and I also have a search button for the right panel on the page and if this button is clicked the created textbox will disappear. Any help would be appreciated.</p>