<script type="text/javascript">
     function CheckAllComponent(oCheckbox)
     {
       var GridView1 = document.getElementById("<%=GV_ReleaseResult.ClientID %>");
           for(i = 1;i < GridView1.rows.length; i++)
           {
            GridView1.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = oCheckbox.checked;
           }
      }   
    </script>

gridview 模板列中
  <asp:TemplateField HeaderText="Select">
          <HeaderTemplate>
              <input id="Chk_SelectAll" runat="server" type="checkbox" onclick="CheckAllComponent(this)" />Select All
          </HeaderTemplate>
          <ItemTemplate>
          <asp:CheckBox ID="CB_Release" runat="server" />
          </ItemTemplate>
 </asp:TemplateField>

posted on 2009-09-02 15:20  风叶  阅读(218)  评论(0编辑  收藏  举报