Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Dynamically create textboxes using ASP.NET
Posted

C#
TextBox newText = new TextBox();
newText.ID = "newText";
newText.Text="I am a new TextBox";
Form.Controls.Add(newText);


This is from memory. But give that a try and let us know if you have issues.
 
Share this answer
 
 
Share this answer
 
Hi Dear use this technique.

C#
private void CreateTextBox()
        {
            for (int i = 0; i < 3; i++)
            {
                TextBox txtBox = new TextBox();
                txtBox.ID = "Txt" + Convert.ToString(i + 1);
                txtBox.Text = "TextBox" + Convert.ToString(i + 1);
                this.Panel1.Controls.Add(txtBox);
            }
        }
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900