页面只有<asp:CheckBoxList ID="CheckIssue" runat="server" CssClass="CheckBoxList1" RepeatColumns="3"
                        RepeatDirection="Horizontal">
                        <asp:ListItem Value="0">全选</asp:ListItem>
                        <asp:ListItem Value="1">哈尔滨</asp:ListItem>
                        <asp:ListItem Value="2">北京</asp:ListItem>
                    </asp:CheckBoxList>用js或者jquery实现都行(只要前台实现,页面不刷新),当我点击“全选”的时候 都选中,再次点击“全选” 则都不选中。

解决方案 »

  1.   

    还是不要用服务器控件了
    看下这里http://hbluojiahui.blog.163.com/blog/static/3106476720098110547234/
      

  2.   

    全选 
    protected void Button2_Click(object sender, EventArgs e)

    int max = 0; //判断复选框选中数量
            int min=0;
            foreach (GridViewRow row in GridView1.Rows)
            {
                CheckBox checkNews = (CheckBox)row.FindControl("CheckBox1");  //查询CheckBox1的控件
                if ((checkNews).Checked)
                {
                    max++;
                    HtmlInputHidden hiInput = (HtmlInputHidden)(checkNews.FindControl("HiddenSysCode"));//获取隐藏文本框的值
                    int i = row.RowIndex;
                    string ss = hiInput.Value;
                    string sqltemp = "update tb_datalist_info set state={1} where id={0} ";
                    sqltemp = string.Format(sqltemp, ss, 2 );
                    SQLDBHelper.ExecuteNonQuery(sqltemp);            }
                min++;
            }        if (max != 0)
            {
                .......
            }
            else
            {
               ........
            }
            DataBindForGrid();
    }
      

  3.   


            function selectAll(obj){
                $(obj).parents("tr").siblings().each(function(){
                    $(this).find(":checkbox").attr("checked",$(obj).attr("checked"))
                })
            }
    <asp:CheckBox ID="CheckBox1" onclick="selectAll(this)" runat="server" />选择