Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Sorting and Paging (Pagination) in Razor Functions?

$
0
0
We don't have a sample online, but in Razor (C#) you have LINQ which makes these sorts of things pretty easy:
var pages = Data.Get<IPage>().OrderBy(f=>f.Title).Skip(40).Take(20);
This code grabs pages, orders by the page Title field, skips the first 40 results and takes the next 20 results (so result 41-60).

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>