动态添加控件并添加事件
private void Page_Load(object sender, System.EventArgs e)
{
Button Button1 = new Button();
Button1.CommandArgument = "b1";
Button1.Text = "Btn1";
Button1.Command += new CommandEventHandler(this.OnButton);
PlaceHolder1.Controls.Add(Button1);
Button Button2 = new Button();
Button2.CommandArgument = "b2";
Button2.Text = "Btn2";
Button2.Command += new CommandEventHandler(this.OnButton);
PlaceHolder1.Controls.Add(Button2);
Control c3 = ParseControl("<asp:Button id='Button3' text='Btn3' commandname='Btn' commandargument='b3' runat='server' />"); //将字符串转换成web控件
Control c4 = ParseControl("<asp:Button id='Button4' text=&