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

 

使用aspNetPager分页,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。