我有一个用于共享点的可视化 Web 部件,代码如下,但点击处理程序的代码永远不会触发。我的代码有什么问题?:
protected Button btApply;
protected void Page_Load(object sender, EventArgs e)
{
... some code ...
btApply = new Button();
btApply.Text = "Apply";
btApply.CssClass += "InputControl";
btApply.Click += new EventHandler(btApplyClick);
this.Controls.Add(btApply);
... some code ...
}
protected void btApplyClick(object sender, EventArgs e)
{
... some code ...
}