Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is my code for grid, i want to give global chkboxes so when above chboxes selected below chkbox will get selecetd automatically?
XML
<div class="srchBxUserRights" id="GridDisplay" style="display: none;">
                <asp:GridView ID="gvParentGrid" ShowHeaderWhenEmpty="true" runat="server" DataKeyNames="ui_name" Width="100%"
                    AutoGenerateColumns="false" OnRowDataBound="gvParent_RowDataBound" GridLines="none" ShowHeader="false" >
                    <HeaderStyle Height="0px" HorizontalAlign="Center" Font-Size="5px" VerticalAlign="Middle"></HeaderStyle>
                    <rowstyle cssclass="DG_ItemStyle" horizontalalign="left" verticalalign="Middle" />
                    <alternatingrowstyle cssclass="DG_ItemStyle" horizontalalign="left" verticalalign="Middle" />
                    <columns>
                    <asp:TemplateField ItemStyle-Width="0px">
                            <itemtemplate>
                           <%-- <a href="java<!-- no -->script:divexpandcollapse('div<%# Eval(" id=") %>');">
                                <img id="imgdiv<%# Eval("ID") %>" width="9px" border="0" src="../../images/drop1.gif" />
                            </a>--%>
                            </itemtemplate>

                        <asp:BoundField DataField="UI_NAME" HeaderText="UI_NAME" HeaderStyle-HorizontalAlign="Left" ItemStyle-Font-Bold="true"/>
                        <asp:BoundField DataField="ID" ItemStyle-Font-Size="1px" HeaderStyle-HorizontalAlign="Left" />
                        <asp:TemplateField>
                            <itemtemplate>
                            <tr>
                            <td colspan="100%">
                            <div id="div<%# Eval(" style="display: BLOCK; removed: relative; removed 15px; overflow: auto;">
                                 <asp:GridView ID="gvChildGrid" runat="server" OnRowDataBound="gvChild_RowDataBound" AutoGenerateColumns="false" GridLines="none"  Width="650px" >
                                <HeaderStyle Height="32px" CssClass="DG_ChildHeaderStyle" Font-Bold="true" HorizontalAlign="Center" VerticalAlign="Middle"></HeaderStyle>
                                <rowstyle cssclass="DG_ItemStyle" horizontalalign="left" verticalalign="Middle" />
                                <alternatingrowstyle cssclass="DG_AlternateItemStyle" horizontalalign="left" verticalalign="Middle" />
                                <columns>
                                    <asp:BoundField DataField="UI_NAME" HeaderText="" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="20%" />
                                     <asp:TemplateField HeaderText="Access" HeaderStyle-HorizontalAlign="Left" >
                                        <itemtemplate>
                                            <asp:CheckBox runat="server" ID="ui_access" />
                                        </itemtemplate>

                                     <asp:TemplateField HeaderText="Add" HeaderStyle-HorizontalAlign="Left" >
                                        <itemtemplate>
                                            <asp:CheckBox runat="server" ID="ui_add" />
                                        </itemtemplate>

                                    <asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Left" >
                                        <itemtemplate>
                                            <asp:CheckBox runat="server" ID="ui_edit" />
                                        </itemtemplate>
                                    </columns></div></td></tr></itemtemplate></columns></div>
Posted
Updated 6-Aug-13 1:31am
v7
Comments
sumit_kapadia 4-Aug-13 3:58am    
Where is your code

1 solution

check the below code
JavaScript
  $("#GlobalChkboxesId").change(function() {

$("#GridID input:checkbox').attr('checked', $(this).is(':checked'))

}) ;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900