Coolite中动态添加按钮,用传统的 btn.Click +=new EventHandler(btn_Click);无法使用,所以使用了下面这个方法:
for (int i = 1; i <= QuestionCount; i++)
{
Coolite.Ext.Web.Button btn = new Coolite.Ext.Web.Button();
btn.ID = "btn" + i.ToString();
btn.Text = i.ToString();
string btnText = i.ToString();
btn.Listeners.Click.Handler = string.Format ( "Coolite.AjaxMethods.btn_Click('{0}');",i.ToString ());
FormPanel1.Controls.Add(btn);
}
[AjaxMethod]
public void btn_Click(string btnText)
{
Ext.Msg.Alert("提示", btnText).Show();
}