///<summary>///Binding a news list with pagination and query///</summary>///<param name=A></param>///<param name="AspNetPager1"></param>///<param name="Filter"></param>ProtectedvoidBindlist (RepeaterAAspnetpagerAspNetPager1,expression<func<Bool>>Filter) {Classno =request["Classno"];VarNew_list =Newlist<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 + = (CD) = = {bindlist (a, Aspnetpager1, null); }; a.new_list; a.databind (); } catch { } }
The
Encapsulates the common method of WebForm: For software I enclose these in pagebase, so that all the pages are called only one Init (), and the others are all configured on the page