America/US Samples
Europe Samples
Asia Samples

Gaia Ajax: GridView - Select Multiple Rows

Selecting all or just one and one row in a Gaia GridView is fairly simple. Here are some simple logic for having a Gaia CheckBox in the header, which will select or deselect all the checkboxes in the rows. If you select one by one and all are finally selected, then the checkbox in the header will be chekced as well.

PersonActivity Name
Tom NielsenWrite Blog
Myron AndersonDevelopment
Jenna CroftQuality Assurance
Lucy FarradayCode Review
Myron ScholesFix Bugs
Myron AndersonWrite Blog
Jenna CroftDevelopment
Jenna CroftDevelopment
Tom NielsenSales Presentation
Isabelle MeyersCustomer meeting
Tom NielsenBusiness lunch
Jenna CroftCreate Unit Tests
Erik FarradayCustomer meeting
Lucy FarradayRead newspapers
Isabelle MeyersStaff meeting
Myron ScholesMorning meeting
Isabelle MeyersQuality Assurance
Isabelle MeyersDesign Architecture
Myron AndersonQuality Assurance
Jenna CroftMorning meeting
Tom NielsenDevelopment
Tom NielsenInterview
Tom NielsenAttend Seminar
Erik FarradayDevelopment
Myron AndersonStaff meeting

Markup (ASPX/.aspx)

   1:   
   2:  <gaia:GridView ID="zGrid" runat="server" AutoGenerateColumns="false">
   3:      <Columns>
   4:          <asp:TemplateField>
   5:              <HeaderTemplate>
   6:                  <gaia:CheckBox 
   7:                      runat="server" 
   8:                      ID="cbxHeader"
   9:                      AutoPostBack="true" 
  10:                      OnCheckedChanged="cbxHeader_OnCheckedChanged" />
  11:              </HeaderTemplate>
  12:           <ItemTemplate>
  13:              <gaia:CheckBox 
  14:                  runat="server" 
  15:                  ID="cbx" 
  16:                  AutoPostBack="true" 
  17:                  OnCheckedChanged="cbx_OnCheckedChanged" />
  18:              </ItemTemplate>
  19:          </asp:TemplateField>
  20:          <gaia:BoundField DataField="ContactPerson" HeaderText="Person" />
  21:          <gaia:BoundField DataField="ActivityName" HeaderText="Activity Name" />
  22:      </Columns>
  23:  </gaia:GridView>
  24:  <gaia:Label 
  25:      runat="server" 
  26:      ID="zStatus" />
  27: