Link to home
Start Free TrialLog in
Avatar of Jerry Miller
Jerry MillerFlag for United States of America

asked on

Nested Gridviews header template checkbox issue

I have a nested gridview in which I am trying to get 'select all' functionality working. In the Header Template I want a checkbox that when checked will select all of the checkboxes in that grid.

Below is the code that I have in the aspx page. I added the radiobutton and the button as a test, both work as intended and select the child checkboxes by firing the systemSelectAll_CheckChanged() event in the code behind. The chkApproveAll checkbox does not fire this event at all. I can use a button or radiobutton if necessary, but a checkbox would give more consistent look to the page.

Any ideas as to why the checkbox does not fire the event while the radiobutton and button both do? The chkApprove checkbox in the ItemTemplate above it works fine as well.


<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
 <ItemTemplate>
    <asp:CheckBox ID="chkApprove" runat="server" OnCheckedChanged="systemApprove_CheckChanged" AutoPostBack="true" />
  </ItemTemplate>
  <HeaderTemplate>
  <asp:Label ID="lblApprove" Text="Approve&#10;All" runat="server" /><br /><br />  
 
<asp:RadioButton ID="rbApproveAll" runat="server" AutoPostBack="true" OnCheckedChanged="systemSelectAll_CheckChanged" />
           
<asp:CheckBox ID="chkApproveAll" runat="server" OnCheckChanged="systemSelectAll_CheckChanged" TextAlign="Left" AutoPostBack="true"/>

<asp:Button ID="btnApprove" runat="server" OnClick="systemSelectAll_CheckChanged" />
</HeaderTemplate>
</asp:TemplateField>
ASKER CERTIFIED SOLUTION
Avatar of Rajar Ahmed
Rajar Ahmed
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jerry Miller

ASKER

Thanks, I didn't think about using a hidden control.