C#动态添加CheckBox 及其事件时,无法响应事件..
protectedvoidPage_Load(objectsender,EventArgse){if(!IsPostBack){CheckBoxchk=newCheckB...
protected void Page_Load(object sender, EventArgs e){
if (!IsPostBack){
CheckBox chk = new CheckBox();
chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
chk.AutoPostBack = true;
chk.ID = “topid”;
chk.Text = “toptitle”;
}
}
void chk_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
}
} 展开
if (!IsPostBack){
CheckBox chk = new CheckBox();
chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
chk.AutoPostBack = true;
chk.ID = “topid”;
chk.Text = “toptitle”;
}
}
void chk_CheckedChanged(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询