I'm having trouble using Skip() and Take() to acheive pagination on a set of Examine SearchResults, getting an error
macroScripts\SearchResults.cshtml(46): error CS1973: 'System.Linq.IQueryable'
has no applicable method named 'Skip' but appears to have an extension
method by that name. Extension methods cannot be dynamically dispatched.
Consider casting the dynamic arguments or calling the extension method
without the extension method syntax.
Abbrieviated source;
var pagesToList = ExamineManager.Instance.SearchProviderCollection["ContentSearcher"].Search(filter).Distinct().AsQueryable();
// lots of pagination stuff trimmed
@foreach (var item in pagesToList.Skip(currentPage * itemsPerPage).Take(itemsPerPage)) { <li>@item.Name</li> }
Surely Skip() and Take() should be available? I've tried casting pagesToList to a DynamicNodeList, and no luck there either?
Doh, I knew if I posted the solution would appear... The clue is in the error "Consider casting the dynamic arguments" - itemsPerPage was dynamic, so needed casting to an int.
Linq Extension methods on Examine SearchResults
I'm having trouble using Skip() and Take() to acheive pagination on a set of Examine SearchResults, getting an error
macroScripts\SearchResults.cshtml(46): error CS1973: 'System.Linq.IQueryable' has no applicable method named 'Skip' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
Abbrieviated source;
Surely Skip() and Take() should be available? I've tried casting pagesToList to a DynamicNodeList, and no luck there either?
Phil
Doh, I knew if I posted the solution would appear... The clue is in the error "Consider casting the dynamic arguments" - itemsPerPage was dynamic, so needed casting to an int.
Phil
is working on a reply...