1
Answer

CheckBoxList in TemplateField/ItemTemplate

Rick Sharp

Rick Sharp

11y
2.9k
1
Hello All, 

I am using a CheckBoxList/ItemTemplate/FieldTemplate/GridView as below:

<asp:GridView ID="GridView1" runat="server"  
    AutoGenerateColumns="False"  
    GridLines="Both"  
   CssClass="mGrid" 
   PagerStyle-CssClass="pgr"  
    AlternatingRowStyle-CssClass="alt">
<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
    <Columns>  
            <asp:TemplateField HeaderText="Check Box"> 
            <ItemTemplate>
                <asp:CheckBoxList ID="CheckBoxList1" runat="server">
                    <asp:ListItem></asp:ListItem>
                </asp:CheckBoxList>
            </ItemTemplate>
            </asp:TemplateField>
    </Columns>  
  <PagerStyle CssClass="pgr"></PagerStyle>   
</asp:GridView>

Codebehind should be:

If ( ALL the checkboxes in GridView1 are checked),
{
        continue. 
}
Else
        Message Box saying "Please Check the missing CheckBoxes". End

How to achieve this?




Answers (1)