在一个用户控件中有如下代码
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="height:25px">
<b> Check all that apply:<!--<a href="javascript:checkall();">Check all that apply:</a>--></b>
</td>
</tr>
<asp:Repeater ID="repDiscipline" runat="server" OnItemDataBound="repDiscipline_ItemDataBound" OnItemCreated="repDiscipline_ItemCreated">
<ItemTemplate>
<tr>
<td style="height:35px"><input type="checkbox" id="checkall" runat="server" /><b><asp:Label ID="lblDiscipline" runat="server" Text='<%# Eval("name") %>'></asp:Label></b><asp:Literal ID="litId" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Literal></td>
</tr>
<tr>
<td><asp:CheckBoxList ID="chbdesciption" runat="server" RepeatDirection="horizontal" RepeatColumns="4" RepeatLayout="table">
</asp:CheckBoxList></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>要求点checkall的时候 全选/全清的效果,注意,是对同一个itemtemplate下面的,就是说是大类和小类的关系,点击大类的checkall时,这个大类下的所有小类被选中或全清
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="height:25px">
<b> Check all that apply:<!--<a href="javascript:checkall();">Check all that apply:</a>--></b>
</td>
</tr>
<asp:Repeater ID="repDiscipline" runat="server" OnItemDataBound="repDiscipline_ItemDataBound" OnItemCreated="repDiscipline_ItemCreated">
<ItemTemplate>
<tr>
<td style="height:35px"><input type="checkbox" id="checkall" runat="server" /><b><asp:Label ID="lblDiscipline" runat="server" Text='<%# Eval("name") %>'></asp:Label></b><asp:Literal ID="litId" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Literal></td>
</tr>
<tr>
<td><asp:CheckBoxList ID="chbdesciption" runat="server" RepeatDirection="horizontal" RepeatColumns="4" RepeatLayout="table">
</asp:CheckBoxList></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>要求点checkall的时候 全选/全清的效果,注意,是对同一个itemtemplate下面的,就是说是大类和小类的关系,点击大类的checkall时,这个大类下的所有小类被选中或全清
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货