急救啊!动态添加按钮
动态添加一个按钮 可不知道怎么给那个按钮写Click事件麻烦各位帮帮忙,写个获得填写值的事件
先谢了
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//第一行
Label l1 = new Label();
l1.Text = "用户名 ";
TextBox t1 = new TextBox();
TableCell tr1_tc1 = new TableCell();
TableCell tr1_tc2 = new TableCell();
tr1_tc1.Controls.Add(l1);
tr1_tc2.Controls.Add(t1);
TableRow tr1 = new TableRow();
tr1.Cells.Add(tr1_tc1);
tr1.Cells.Add(tr1_tc2);
//第二行
Label l2 = new Label();
l2.Text = "密码 ";
TextBox t2 = new TextBox();
t2.TextMode = TextBoxMode.Password;
TableCell tr2_tc1 = new TableCell();
TableCell tr2_tc2 = new TableCell();
tr2_tc1.Controls.Add(l2);
tr2_tc2.Controls.Add(t2);
TableRow tr2 = new TableRow();
tr2.Cells.Add(tr2_tc1);
tr2.Cells.Add(tr2_tc2);
Button b1 = new Button();
b1.Text = "登录 ";
TableCell tr3_tc1 = new TableCell();
tr3_tc1.Controls.Add(b1);
TableRow tr3 = new TableRow();
tr3.Cells.Add(tr3_tc1);
Table1.Rows.Add(tr1);
Table1.Rows.Add(tr2);
Table1.Rows.Add(tr3);