您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> .NET >> ASPxGridView通过CheckBox全选后,分页有点问题,贴上代码

ASPxGridView通过CheckBox全选后,分页有点问题,贴上代码

来源:网络整理     时间:2016/6/28 1:38:15     关键词:

关于网友提出的“ ASPxGridView通过CheckBox全选后,分页有点问题,贴上代码”问题疑问,本网通过在网上对“ ASPxGridView通过CheckBox全选后,分页有点问题,贴上代码”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: ASPxGridView通过CheckBox全选后,分页有点问题,贴上代码
描述:

cs代码

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CheckUser();             }             DataBound();            //这一行放到IsPostBack中时全选可以,分页不可,放在此行的话全选不可,分页可以。         }         private void DataBound()
        {             SMReceiveBLL smreceivebll = new SMReceiveBLL();             DataSet ds = smreceivebll.GetList("");             dxGrid.DataSource = ds.Tables[0];
            dxGrid.DataBind();         }         protected void selectAll_CheckedChanged(object sender, EventArgs e)         {             int startid = dxGrid.PageIndex * dxGrid.SettingsPager.PageSize;             int endid;             if (dxGrid.PageIndex == dxGrid.PageCount - 1)
            {                 endid = dxGrid.VisibleRowCount;
            }
            else
            {                 endid = (dxGrid.PageIndex + 1) * dxGrid.SettingsPager.PageSize;             }
            CheckBox cbHead = (CheckBox)sender;             if (cbHead.Checked == true)             {                 CheckBox cb;                 for (int i = startid; i < endid; i++)                 {                     cb = (CheckBox)dxGrid.FindRowCellTemplateControl(i, (GridViewDataColumn)dxGrid.Columns["cbxselectAll"], "cbxSelect");
                    cb.Checked = true;                 }             }             else             {                 CheckBox cb;
                for (int i = startid; i < endid; i++)                 {                     cb = (CheckBox)dxGrid.FindRowCellTemplateControl(i, (GridViewDataColumn)dxGrid.Columns["cbxselectAll"], "cbxSelect");                     cb.Checked = false;
                }             }         }
前台代码

                                                                                ' visible="false">                 ' visible="false">
                                                                            
            
        

                                                                                

可有方法解决呢,似乎有冲突
以上介绍了“ ASPxGridView通过CheckBox全选后,分页有点问题,贴上代码”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2117865.html

相关图片

相关文章