Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery自动选中复选框_Jquery_Html_Asp.net - Fatal编程技术网

使用jQuery自动选中复选框

使用jQuery自动选中复选框,jquery,html,asp.net,Jquery,Html,Asp.net,我有3级嵌套中继器,如代码所示 第二个(RpMenu)中继器具有复选框,应选中第三个(RbItems)中继器中的所有复选框 如何使用JQuery实现这一点 <asp:Repeater ID="RpGroups" runat="server" OnItemDataBound="RpGroups_ItemDataBound"> <ItemTemplate> <asp:Label ID="GID" runat="server" Text='<

我有3级嵌套中继器,如代码所示

第二个(
RpMenu
)中继器具有复选框,应选中第三个(
RbItems
)中继器中的所有复选框

如何使用JQuery实现这一点

<asp:Repeater ID="RpGroups" runat="server" OnItemDataBound="RpGroups_ItemDataBound">
    <ItemTemplate>
        <asp:Label ID="GID" runat="server" Text='<%# Eval("groupid")%>' Visible="false"> </asp:Label>
        <div class="panel  panel-primary ">
            <a class="accordion-toggle" data-toggle="collapse" href="#<%# Eval("groupid")%>">
                <div class="panel-heading">

                    <h3 class="panel-title"><%# Eval("groupName")%>   </h3>


                </div>

            </a>
            <div class="panel-body ">
                <div class="accordion-body collapse" id="<%# Eval("groupid")%>">

                    <asp:Repeater ID="RpMenu" runat="server" OnItemDataBound="FillMenuItems">
                        <ItemTemplate>
                            <div class="panel panel-red">
                                <div class="panel-heading">

                                    <h3 class="panel-title" style="text-align: center"><%# Eval("HeadItemText")%>
                                        <div class="navbar-right"></div>
                                    </h3>
                                </div>
                                <div class="panel-body">
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("HeaderMenuId")%>' Visible="false"></asp:Label>
                                    <table class="table table-striped ">
                                        <thead>
                                            <tr class="alert-danger">
                                                <th></th>
                                                <th class="col-sm-2 control-label">Page Name</th>
                                                <th>
                                                    <input id="Checkbox1" type="checkbox" value="Full Add" runat="server" onclick="checkadd()" />Full Add</th>
                                                <script type="text/javascript">
                                                    function checkadd() {
                                                        if (document.getElementById('Checkbox1').checked) {


                                                        }
                                                        else {

                                                        }
                                                    }
                                                </script>
                                                <th>
                                                    <input id="Checkbox2" type="checkbox" value="Full View" onclick="checkview()" />Full View</th>
                                                <script type="text/javascript">
                                                    function checkview() {
                                                        if (document.getElementById('Checkbox2').checked) {


                                                        }
                                                        else {

                                                        }
                                                    }
                                                </script>
                                                <th>
                                                    <input id="Checkbox3" type="checkbox" value="Full Updte" onclick="checkupdat()" />Full Updte</th>
                                                <script type="text/javascript">
                                                    function checkupdat() {
                                                        if (document.getElementById('Checkbox3').checked) {


                                                        }
                                                        else {

                                                        }
                                                    }
                                                </script>
                                                <th>
                                                    <input id="Checkbox4" type="checkbox" value="Full Delete" onclick="checkdelet()" />Full Delete</th>
                                                <script type="text/javascript">
                                                    function checkdelet() {
                                                        if (document.getElementById('Checkbox4').checked) {


                                                        }
                                                        else {

                                                        }
                                                    }
                                                </script>
                                            </tr>
                                        </thead>
                                    </table>
                                    <asp:Repeater ID="RbItems" runat="server">

                                        <ItemTemplate>
                                            <div class="table-responsive">
                                                <table class="table table-striped table-hover">


                                                    <tr class="view">
                                                        <td>
                                                            <asp:Label ID="PID" runat="server" Text='<%# Eval("tblMenuItemID")%>' Visible="false"></asp:Label></td>
                                                        <td class="col-sm-2 control-label"><strong>
                                                            <div><%# Eval("MenuItemName")%></div>
                                                        </strong></td>


                                                        <td>
                                                            <asp:CheckBox ID="Add" runat="server" Text="Add" /></td>
                                                        <td>
                                                            <asp:CheckBox ID="View" runat="server" Text="View" /></td>
                                                        <td>
                                                            <asp:CheckBox ID="Edit" runat="server" Text="Update" /></td>
                                                        <td>
                                                            <asp:CheckBox ID="Delete" runat="server" Text="Delete" /></td>
                                                    </tr>

                                                </table>
                                            </div>
                                            <%-- <li>
                                                <a href="<%# Eval("MenuItemLink")%>"><%# Eval("MenuItemName")%></a>
                                            </li>--%>
                                        </ItemTemplate>
                                    </asp:Repeater>

                                </div>
                            </div>

                        </ItemTemplate>
                    </asp:Repeater>
                </div>
            </div>




        </div>
    </ItemTemplate>
</asp:Repeater>

--%%>

我需要确保,当我选中“复选框1”时,中继器3中所有名为“Add”的复选框都被选中。

到目前为止,您尝试了什么?第二个中继器中的1个复选框选中第三个定义名为“Add”的中继器中的所有复选框示例发布您的jQuery代码,以便我们可以看到您到目前为止做了什么。您应该尝试创建一个尽可能小的用例,并将其发布在这里。您发布的大多数代码与问题无关。我需要jquery代码bro,例如,我有名为chkdelete()的方法,我可以检测何时选中复选框,但我忽略了如何选中其他复选框(3'd repeater),因此您希望我们做您的工作吗?:)