1
Answer

Adding TextBox Programmatically..

Sanjeev Shrestha

Sanjeev Shrestha

17y
3.8k
1

Hello,

I am using ASP.NET 2.0. I am trying to add textBox programmatically.
I have following method.... It is not working. What do I need to add.

public partial class Default: System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
    {
        TextBox textBox = new TextBox();   
        textBox.Text = "Joe";

        Panel panel = new Panel();
        panel.Visible = true;
        panel.Controls.Add(textBox);       
       
    }
}

Thank you,

Answers (1)