Avatar of Ed
Ed
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Make Sure All Check boxs are Checked in Gridview

I have a gridview that in the last column has a checkbox column(chkLiveDiscussed).    The number of rows in the gridview could be anything between 2 to 20

I have a checkbox outside of the grid view(chkAllDiscussed) that i ONLY want enabled when all of the rows i the gridview have the checkbox(chkLiveDiscussed) checked.  How can I achieve this?

   <asp:GridView ID="gvLiveLearners" runat="server" DataSourceID="dsLiveLeaners" AutoGenerateColumns="False" CssClass="tableAc" DataKeyNames="PROGRESS_RAG" BorderColor="#B2CB96" BorderStyle="Dotted" BorderWidth="1px">
                        <Columns>
                            <asp:BoundField DataField="FULLNAME" HeaderText="FULLNAME" SortExpression="FULLNAME" />
                            <asp:BoundField DataField="SECTOR" HeaderText="Route" SortExpression="SECTOR" />
                            <asp:BoundField DataField="SCHEME" HeaderText="Level" SortExpression="SCHEME" />
                            <asp:BoundField DataField="LATEST_REVIEW" HeaderText="Last Review" ReadOnly="True" SortExpression="LATEST_REVIEW" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="AptStartTime" HeaderText="Next Review" SortExpression="AptStartTime" DataFormatString="{0:d}" />
                            <asp:BoundField DataField="NextAptWith" HeaderText="NextAptWith" ReadOnly="True" SortExpression="NextAptWith" Visible="False" />
                            <asp:BoundField DataField="NUM_REVIEWS" HeaderText="Num Reviews" ReadOnly="True" SortExpression="NUM_REVIEWS" HeaderStyle-CssClass="hidden" ItemStyle-CssClass="hidden" />
                            <asp:BoundField DataField="MonthOnPOT" HeaderText="MonthOnPOT" ReadOnly="True" SortExpression="MonthOnPOT" />
                            <asp:BoundField DataField="MonthsOnProgramme" HeaderText="Months on Program" ReadOnly="True" SortExpression="MonthsOnProgramme" />
                            <asp:BoundField DataField="EARLIEST_START_DATE" HeaderText="EARLIEST_START_DATE" ReadOnly="True" SortExpression="EARLIEST_START_DATE" DataFormatString="{0:d}" Visible="False" />
                            <asp:BoundField DataField="POTSTATUS" HeaderText="POTSTATUS" SortExpression="POTSTATUS" />
                            <asp:BoundField DataField="PROGRESS_RAG" HeaderText="PROGRESS_RAG" ReadOnly="True" SortExpression="PROGRESS_RAG" >
<HeaderStyle CssClass="hidden"></HeaderStyle>

<ItemStyle CssClass="hidden"></ItemStyle>
                            </asp:BoundField>
                            <asp:BoundField DataField="CURRENT_PDM" HeaderText="CURRENT_PDM" SortExpression="CURRENT_PDM" />
                            <asp:BoundField DataField="CONTRACT" HeaderText="CONTRACT" SortExpression="CONTRACT" Visible="False" />
                            <asp:BoundField DataField="TRAINEEID" HeaderText="TRAINEEID" ReadOnly="True" SortExpression="TRAINEEID" Visible="False" />
                            <asp:BoundField DataField="POT" HeaderText="POT" ReadOnly="True" SortExpression="POT" Visible="False" />
                            <asp:BoundField DataField="POTSTATUSID" HeaderText="POTSTATUSID" SortExpression="POTSTATUSID" Visible="False" />
                            <asp:TemplateField HeaderText="Discussed">
                              
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkLiveDiscussed" runat="server" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                   
                           <span class="auto-style5">There are no live learners at this branch</span>
                        </EmptyDataTemplate>
                        <HeaderStyle BackColor="#AEC785" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <RowStyle BorderStyle="Dashed" BorderWidth="1px" HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:GridView>   <asp:CheckBox ID="chkAllDiscussed" Enabled="False"  runat="server" />

Open in new window



Thanks
ASP.NETVisual Basic.NET.NET Programming

Avatar of undefined
Last Comment
Ed

8/22/2022 - Mon