layui页面跳转,带参数,跳到指定页laypage.render

JS部分

页面部分

页面CS类部分

private void GetSubjectsList()
{
string searchStr = "";

            int pageIndex = Convert.ToInt32(Request["pageIndex"]);
            int pageSize = Convert.ToInt32(Request["pageSize"]);
            pageIndex = pageIndex == 0 ? 1 : pageIndex;
            pageSize = pageSize == 0 ? 10 : pageSize;
            List listtemp = Templates_SubjectsBLL.SelectByPage(searchStr, "id", (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);//分页读取记录
}

DAL类

/// 
        /// 根据条件查询分页数据
        /// 
        /// 查询条件,以and开头
        /// 
        public static List SelectByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            
            List list = new List();

            StringBuilder builder = new StringBuilder();
            builder.Append("SELECT * FROM ( ");
            builder.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                builder.Append("order by T." + orderby);
            }
            else
            {
                builder.Append("order by T.ID desc");
            }
            builder.Append(")AS Row, T.*  from Templates_Subjects T  ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                builder.Append(" WHERE " + strWhere);
            }
            builder.Append("  ) TT");
            builder.AppendFormat(" WHERE TT.Row between {0} and {1}  ", startIndex, endIndex);

            DataTable table = SqlHelper.ExecuteReader(builder.ToString(), CommandType.Text);
            if (table == null || table.Rows.Count == 0)
            {
                return null;
            }
            else
            {
                Templates_SubjectsModel templates_SubjectsModel = null;
                foreach (DataRow row in table.Rows)
                {
                    templates_SubjectsModel = new Templates_SubjectsModel();
                    templates_SubjectsModel.Id = (int)table.Rows[0]["ID"];
                    templates_SubjectsModel.Titles = (string)table.Rows[0]["titles"];
                    templates_SubjectsModel.Scores = (int)table.Rows[0]["scores"];
                    templates_SubjectsModel.AddTime = (DateTime)table.Rows[0]["addTime"];
                    templates_SubjectsModel.IsDel = (int)table.Rows[0]["isDel"];
                    list.Add(templates_SubjectsModel);
                }
                return list;
            }
        }

 

 

你可能感兴趣的:(layui)