首页 > 代码库 > 使用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; } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。