Everything that's a direct child of your Columns collection needs to be a DataControlField
type control (CheckBoxField, ButtonField, etc).
Thus. you need to put all of that Panel
stuff inside a <Templatefield>
, which allows you to create a custom field.
And you need to convert all of those CheckBoxFields to just regular checkboxes, bind those CheckBoxes to the data fields you wanted, and you should be good
<asp:TemplateField>
<asp:Panel ID="pnlClick" runat="server" CssClass="collapsiblepanelCSS">
<div style="background-color:blue;height:30px; vertical-align: middle">
<div style="float: left;color:white;padding: 5px 5px 0 0 ">
Server List Collapsable Panel
</div>
<div style="float: right; color: white; padding: 5px 5px 0 0" id="divshow">
<asp:Label ID="lblMessage" runat="server" Text="Label" />
</div>
<div style="clear:both">
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnlCollapsable" runat="server" Height="0" CssClass="collapsiblepanelCSS">
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%=Eval("Check Box 1") %>' Text="Check Box 1" />
<asp:CheckBox ID="CheckBox2" runat="server" Checked='<%=Eval("Check Box 2") %>' Text="Check Box 2" />
<asp:CheckBox ID="CheckBox3" runat="server" Checked='<%=Eval("Check Box 3") %>' Text="Check Box 3" />
<asp:CheckBox ID="CheckBox4" runat="server" Checked='<%=Eval("Check Box 4") %>' Text="Check Box 4" />
<asp:CheckBox ID="CheckBox5" runat="server" Checked='<%=Eval("Check Box 5") %>' Text="Check Box 5" />
<asp:CheckBox ID="CheckBox6" runat="server" Checked='<%=Eval("Check Box 6") %>' Text="Check Box 6" />
<asp:CheckBox ID="CheckBox7" runat="server" Checked='<%=Eval("Check Box 7") %>' Text="Check Box 7" />
<asp:CheckBox ID="CheckBox8" runat="server" Checked='<%=Eval("Check Box 8") %>' Text="Check Box 8" />
<asp:CheckBox ID="CheckBox9" runat="server" Checked='<%=Eval("Check Box 9") %>' Text="Check Box 9" />
<asp:CheckBox ID="CheckBox10" runat="server" Checked='<%=Eval("Check Box 10") %>' Text="Check Box 10" />
<asp:CheckBox ID="CheckBox11" runat="server" Checked='<%=Eval("Check Box 11") %>' Text="Check Box 11" />
<asp:CheckBox ID="CheckBox12" runat="server" Checked='<%=Eval("Check Box 12") %>' Text="Check Box 12" />
</asp:Panel>
<CC1:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" Collapsed="true"
ExpandControlID="pnlClick" TextLabelID="lblMessage" CollapsedText="Click To Show"
ExpandedText="Click To Hide" ImageControlID="imgArrows" ExpandDirection="Vertical"
TargetControlID="pnlCollapsable" ScrollContents="false" runat="server">
</CC1:CollapsiblePanelExtender>
</asp:Templatefield>