动态绑定checkbox事件怎么不行啊
在Calendar控件里绑定的checkbox控件事件怎么不行了
public CheckBox CreateCheckBox()
{
CheckBox chk = new CheckBox();
chk.ID = "newcheckbox";
chk.Checked = true;
chk.BorderColor = System.Drawing.Color.BlueViolet;
chk.AutoPostBack = true;
chk.CheckedChanged += new EventHandler(chk_Changed);
return chk;
}
public void chk_Changed(Object sender, EventArgs e)
{
Response.Write("<script language=javascript>alert(\"ffgfg\")</" + "script>");
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
DateTime myAppointment = new DateTime(2007, 5, 24);
if (e.Day.Date == myAppointment)
{
e.Cell.Controls.RemoveAt(0);
e.Cell.Controls.Add(CreateCheckBox());
}
else
{
e.Day.IsSelectable = false;
}
}