Rick Sharp

Rick Sharp

  • NA
  • 8
  • 6.2k

CheckBoxList in TemplateField/ItemTemplate

Jan 23 2013 5:39 PM
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)