Nghich.ORG
New Member
After binding the repeater contron, my check box looks like the below,I have two doubts here..1 - If I select checkbox of Group 1, all the items under group 1 should be selected. How can i do this ? 2 - And I have "Select ALL" button which when clicked should select all the items of all groups. Since the checkbox is inside the repeater control, I not sure how to handle it. Please help\[code\] Group 1 Item 1 Item 2 Group 2 Item 3 Item 4 Group 3 Item 5 Item 6 ASPX : <ol> <asp:Repeater ID="rp_Groups" runat="server" OnItemDataBound="rp_Groups_ItemDataBound"> <ItemTemplate> <ul> <asp:CheckBox RepeatColumns="2" runat="server" ID="chk_Group" Text='<%# Eval("category_type") %>' Value='http://stackoverflow.com/questions/15824587/<%# Eval("service_type_category_id") %>' onclick="OnGroupClick" /> <asp:CheckBoxList runat="server" ID="chkServiceType" style="padding-left:20px" DataValueField="ServiceTypeID" DataTextField="Name" EnableViewState="true" ></asp:CheckBoxList> <br /> </ul> </ItemTemplate> </asp:Repeater> </ol><script type="text/javascript"> function OnGroupClick(group) { for(item in group.getElementsByTagName('input')) { item.checked = group.checked; }} function selectAll() { $("#<%=chkServiceType.ClientID %> input[type=checkbox]").each(function () { this.checked = true; }) }</script>\[/code\]