controls dynamically. The controls are created every time that the page is run. The best place to do this is in the
class provides.
function. Expand the code that is marked with the "Web Form Designer generated code" comment. Modify the
override protected void OnInit(EventArgs e)
{
// Create dynamic controls here.
// Use "using System.Web.UI.WebControls;"
TextBox1 = new TextBox();
TextBox1.ID = "TextBox1";
TextBox1.Style["Position"] = "Absolute";
Form1.Controls.Add(TextBox1);
Label1 = new Label();
Label1.ID = "Label1";
TextBox2.Style["Position"] = "Absolute";
Form1.Controls.Add(Label1);
this.TextBox1.TextChanged += new System.EventHandler(this.TextBox_TextChanged);
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
collection. The code also wires up the
).