推這篇囉: http://blog.xuite.net/juice0708/life/31239364

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


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Width="844px" AllowPaging="True" DataKeyNames="Item_ID"
OnPageIndexChanging ="GridView1_PageIndexChanging" OnRowCommand="GridView1_RowCommand" >

<AlternatingRowStyle BackColor="White" />

<Columns>
<asp:TemplateField>

<HeaderTemplate>

<asp:CheckBox ID="CheckBox2" runat="server" onclick="javascript:Check(this)" />

</HeaderTemplate>

</Columns>

</asp:GridView>

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Kent 的頭像
    Kent

    初學者做網站

    Kent 發表在 痞客邦 留言(0) 人氣()