Continue to complete the first page jump judgment
One, with JS according to click to determine which view and display the corresponding prompt
If it is the home page, it will show the first page and remove breadcrumb navigation
If it is a specific page, according to the DOM to determine the path and display, but also to expand this level of folding and the current view of the a tag plus. Active
The left menu will flash, as it is loaded with the page and then judged to be expanded and selected. This effect is not good, if it is an IFRAME, such as the left is not moving, do not have to judge which level.
functionLoadmenutip () {$ ("#MenuDiv A[title]"). each (function(){ if(Window.location.href.indexOf ($ ( This). attr ("href")) > 0){ var$ This= $( This); varText = $ This. text (); $ (document). attr (' title ', text);//Change the title bar$ This. Parent (). addclass ("active"). Parents (". Panel-collapse"). AddClass ("in");//becomes selected$ ("#MenuTipDiv. Page-title span"). html (text); $("#MenuTipDiv. Page-title small"). HTML ($ This. attr ("title")); $("#MenuTipDiv. Breadcrumb li:eq (0) span"). HTML ("Manage Home"); if($ This. Parent (). Is ("H4")) $ ("#MenuTipDiv. breadcrumb li:gt (0)"). Remove (); Else{ $("#MenuTipDiv. breadcrumb li:eq (1) span"). HTML ($ This. Parents (". Panel-default"). Find (". Panel-heading a"). text ()); $("#MenuTipDiv. Breadcrumb li:eq (2) span"). html (text); } return false; } });}
Second, display data
First manually get a data, and then try to go to the database to fetch.
Source code has pagination public method
/// <summary> ///Paging data collection, for back-end return paginated collection and Front end view page control bindings/// </summary> /// <typeparam name= "T" ></typeparam> Public classPagedlist<t>: list<t>, ipagedlist { PublicPagedlist (ilist<t> items,intPageIndex,intpageSize) {PageSize=pageSize; Totalitemcount=items. Count; CurrentPageIndex=PageIndex; for(inti = Startrecordindex-1; i < Endrecordindex; i++) {Add (items[i]); } } PublicPagedlist (ienumerable<t> items,intPageIndex,intPageSize,intTotalitemcount) {AddRange (items); Totalitemcount=Totalitemcount; CurrentPageIndex=PageIndex; PageSize=pageSize; } Public intextracount{Get;Set;} Public intTotalpagecount = (int) Math.ceiling (totalitemcount/(Double) PageSize); Public intStartrecordindex = (CurrentPageIndex-1) *pagesize +1; Public intEndrecordindex = totalitemcount > currentpageindex*pagesize? currentpageindex*Pagesize:totalitemcount; Public intcurrentpageindex{Get;Set;} Public intpagesize{Get;Set;} Public inttotalitemcount{Get;Set;} } Public Static classpagelinqextensions { Public StaticPagedlist<t> topagedlist<t> ( ThisIqueryable<t> AllItems,intPageIndex,intpageSize) { if(PageIndex <1) PageIndex =1; varItemIndex = (PageIndex-1)*pageSize; varPageofitems =Allitems.skip (ItemIndex). Take (pageSize). ToList (); varTotalitemcount =Allitems.count (); return NewPagedlist<t>(Pageofitems, PageIndex, PageSize, Totalitemcount); } }
I haven't seen it yet, but it's very streamlined.
Ef+mvc+bootstrap Project Practice Day11