checkbox 没有触发OnCheckedChanged事件
<ItemTemplate><asp:CheckBoxID="cb_Select"runat="server"OnCheckedChanged="cb_CheckedCh...
<ItemTemplate>
<asp:CheckBox ID="cb_Select" runat="server" OnCheckedChanged="cb_CheckedChanged" AutoPostBack="True" />
</asp:TemplateField>
protected void cb_CheckedChanged(object sender, EventArgs e)//实现全选
{
for (int i = 0; i < gvAdjustOrderInfo.Rows.Count; i++)
{
CheckBox cb = (CheckBox)gvAdjustOrderInfo.Rows[i].FindControl("cb_Select");
CheckBox cbAll = (CheckBox)sender;
if (cbAll.Checked == true)
{
cb.Checked = true;
}
else
{
cb.Checked = false;
}
}
} 展开
<asp:CheckBox ID="cb_Select" runat="server" OnCheckedChanged="cb_CheckedChanged" AutoPostBack="True" />
</asp:TemplateField>
protected void cb_CheckedChanged(object sender, EventArgs e)//实现全选
{
for (int i = 0; i < gvAdjustOrderInfo.Rows.Count; i++)
{
CheckBox cb = (CheckBox)gvAdjustOrderInfo.Rows[i].FindControl("cb_Select");
CheckBox cbAll = (CheckBox)sender;
if (cbAll.Checked == true)
{
cb.Checked = true;
}
else
{
cb.Checked = false;
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询