On peut créer le contrôle dynamique dans l'événement Page_Init() ou l'événement Page_Load()
protected void Page_Load(object sender, EventArgs e)
{
TextBox dynamicTextBox = new TextBox();
dynamicTextBox.ID = "DynamicTextBox";
dynamicTextBox.AutoPostBack = true;
dynamicTextBox.Text = "InitData";
dynamicTextBox.TextChanged += new EventHandler(dynamicTextBox_TextChanged);
this.Form.Controls.Add(dynamicTextBox);
}
void dynamicTextBox_TextChanged(object sender, EventArgs e)
{
Response.Write("hello");
}
Pour plusieurs informations sur ASP.NET, consultez Foire aux Questions - ASP.NET
Alex Petrescu - MSFT