为什么btnSave_Click没有开火?当我点击它但不跳入处理程序时它会回发。
if (Session["mytable"] != null)
pnlContent.Controls.Add((Table)Session["mytable"]);
else
{
Table table = new Table();
foreach (var item in Items)
{
TableRow row = new TableRow();
table.Rows.Add(row);
if (item.ColumnTypeName == "String")
{
TableCell cell = new TableCell();
row.Cells.Add(cell);
cell.Controls.Add(new LiteralControl(item.ColumnName));
TextBox textbox = new TextBox();
textbox.ID = item.ColumnName;
TableCell cell2 = new TableCell();
row.Cells.Add(cell2);
cell2.Controls.Add(textbox);
}
}
LinkButton btnSave = new LinkButton();
btnSave.ID = "btnSave";
btnSave.Click += new EventHandler(btnSave_Click);
btnSave.Text = "Submit";
TableRow row1 = new TableRow();
table.Rows.Add(row1);
TableCell cell3 = new TableCell();
row1.Cells.Add(cell3);
cell3.Controls.Add(btnSave);
pnlContent.Controls.Add(table);
Session["mytable"] = table;
}
protected void btnSave_Click(object sender, EventArgs e)
{
//TADAA
}