码迷,mamicode.com
首页 > Web开发 > 详细

使用aspNetPager分页

时间:2014-08-13 17:41:06      阅读:231      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   os   ar   div   log   

dll见附件

aspNetPager控件

  public void GridViewBinding(int PageSize, string SqlSelect, string FilterString, string ID, int lower, string OrderBy, GridView gv, Wuqi.Webdiyer.AspNetPager YsmPager1)
    {
        string sql = "";
        sql += "select top " + PageSize.ToString() + " * from ( ";
        sql += " SELECT ROW_NUMBER() OVER (ORDER BY " + ID + ") AS RowNumber,* from (" + SqlSelect + FilterString + ") as a";
        sql += ") b";
        //if (lower > 0)
        //{
        //    sql += " where " + ID + " not in (select top " + lower.ToString() + " " + ID + " from (" + SqlSelect + FilterString + ") as b " + OrderBy + ")";
        //}

        if (lower > 0)
        {
            sql += " where RowNumber>" + lower + "";
        }
        sql += " " + OrderBy + "";

        DataTable dt = MDGL.DBUtility.SQLServerHelper.GetDataTable(CommandType.Text, sql);
        gv.DataSource = dt;
        gv.DataBind();

   
        sql = "select count("+ID+") from ( " + SqlSelect + FilterString + ") as a";
        Object object01 = MDGL.DBUtility.SQLServerHelper.ExecuteScalar(CommandType.Text, sql);

        YsmPager1.RecordCount = int.Parse(object01.ToString());
        if (YsmPager1.RecordCount==0)
        {
            YsmPager1.Visible = false;
        }
        else
        {
            YsmPager1.Visible = true;
        }
         
    }

 

使用aspNetPager分页,布布扣,bubuko.com

使用aspNetPager分页

标签:style   blog   color   使用   os   ar   div   log   

原文地址:http://www.cnblogs.com/zhaolijing910/p/3910083.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!