/// <summary> /// 绑定新闻列表,带分页与查询 /// </summary> /// <param name="a"></param> /// <param name="AspNetPager1"></param> /// <param name="filter"></param> protected void BindList(Repeater a, AspNetPager AspNetPager1, Expression<Func< bool>> filter) { ClassNo = Request["ClassNo"]; var new_list = new List<JY_Newss>(); try { new_list = Common.GetNewsListByCNo(ClassNo).OrderByDescending(u => u.CreateTime).ToList(); AspNetPager1.RecordCount = new_list.Count(); if (AspNetPager1.StartRecordIndex == 1) { new_list = new_list.Take(15).ToList(); } else { new_list = new_list.Skip(AspNetPager1.StartRecordIndex - 1).Take(15).ToList(); } AspNetPager1.PageChanged += (c, d) => { BindList(a, AspNetPager1, null); }; a.DataSource = new_list; a.DataBind(); } catch { } }
时间: 2024-11-07 07:32:42