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
Bob ScholesSales Presentation
Bill FarradayDevelopment
Bill FarradayWrite Blog
Bob ScholesMorning meeting
Bob ScholesMorning meeting
Bill FarradayInterview
Scott AndersonRefactor Code
Bob ScholesQuality Assurance
Bob ScholesCreate Unit Tests
Bill FarradayDevelopment

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: