Tuesday, September 8, 2009

How to create runtime click event on runtime button in asp.net?

protected void Page_Load(object sender, EventArgs e)

{

tb = new TextBox();

btn = new Button();

form1.Controls.Add(tb);

form1.Controls.Add(btn);

btn.Text = "Save";

btn.Click += new EventHandler(btn_click);//generating Event

}

protected void btn_click(object sender, EventArgs e)

{

tb.Text = "hello";

}

No comments:

Post a Comment