Does anyone have a good method for combining pagination with filtering? I have this (simplified) pagination which I've always used, but I can't seem to figure out how to filter the nodes before paginating in the same forech loop?
@if (startNodeID != null) { if (@filingGroup != null) { <h1>@filingGroup</h1> } @* Get the start node as a dynamic node *@ var startNode = Library.NodeById(startNodeID);
//Pagination var pageSize = 20; var pages = 1; int.TryParse(Request.QueryString["page"], out pages); var items = startNode.Children.Where("Visible"); var totalPages = (int)Math.Ceiling((double)items.Count() / (double)pageSize);
if (pages > totalPages) { pages = totalPages; } else if (pages < 1) { pages = 1; }
error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
Paging combined with filtering
Does anyone have a good method for combining pagination with filtering? I have this (simplified) pagination which I've always used, but I can't seem to figure out how to filter the nodes before paginating in the same forech loop?
I think you just need filter before you calculate page count
Hi Benas, how do I set a filter on nodes that haven't been retreived yet? How would I grab the property to filter on?
Hi Benas, that gives me the following:
error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
Examples can be found
http://our.umbraco.org/documentation/Reference/Mvc/querying
Still the same error.
Code snippet works to me
is working on a reply...