首页 > 代码库 > 使用aspNetPager分页

使用aspNetPager分页

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;        }             }