private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int ItemId = Convert.ToInt32(Request.QueryString["id"]); int pageSize = 5;//页面记录数 List <SignUp> list = new List <SignUp>(); int listCount = 0; //查询记录 if (string.IsNullOrEmpty(SreachWhere.Text)) { list = Entity.SignUp.Where(a => a.ItemId == ItemId).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } else { list = Entity.SignUp.Where(a => a.SportsMan.Name.Contains(SreachWhere.Text) && a.ItemId == ItemId).ToList(); listCount = list.Count; list = list.OrderByDescending(a => a.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } //生成导航条 string strBar = PageBar.GetFrontPageBar(pageIndex, listCount, pageSize); mPageBar = strBar; this.Repeater1.DataSource = list; this.Repeater1.DataBind(); }
private void BindData() { int pageIndex = Request.QueryString["pageIndex"] != null?int.Parse(Request.QueryString["pageIndex"]) : 1; int pageSize = 5;//页面记录数 List <News> list = new List <News>(); list = Entity.News.Where(a => true).OrderByDescending(a => a.Id).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); int listCount = Entity.News.Where(a => true).Count(); //生成导航条 string strBar = PageBar.GetFrontPageBar(pageIndex, listCount, pageSize); mPageBar = strBar; this.Repeater1.DataSource = list; this.Repeater1.DataBind(); }