U
Umut Tezduyar
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
}
protected override void OnPreRender(EventArgs e)
{
LinkButton btn = new LinkButton ();
btn.Text = "Click me!";
btn.Click +=new EventHandler(btn_Click);
Control c = Page.FindControl ("Form1");
c.Controls.Add (btn);
}
private void btn_Click(object sender, EventArgs e)
{
int i = 0; // I cannot execute this line
}
}
I have added my class definition. On the html page, there is no extra
control. I add my link button dynamically, but i cannot fire the click
event. Is there a "control life cycle" dislogic. Or is there something that
i dont know ??
{
private void Page_Load(object sender, System.EventArgs e)
{
}
protected override void OnPreRender(EventArgs e)
{
LinkButton btn = new LinkButton ();
btn.Text = "Click me!";
btn.Click +=new EventHandler(btn_Click);
Control c = Page.FindControl ("Form1");
c.Controls.Add (btn);
}
private void btn_Click(object sender, EventArgs e)
{
int i = 0; // I cannot execute this line
}
}
I have added my class definition. On the html page, there is no extra
control. I add my link button dynamically, but i cannot fire the click
event. Is there a "control life cycle" dislogic. Or is there something that
i dont know ??