Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to get some nodes by their first letter, and use the razor paging, briefly using this:
List<DynamicNode> nl = @homeNode.Children.Items;pagesToList = nl.Where(x => x.Name.StartsWith(currentLetter));
Then for the paging:
@foreach(dynamic item in pagesToList.Skip(currentPage*itemsPerPage).Take(itemsPerPage)){.....}
But I get a 'object' does not contain a definition for 'Skip' error.
Hi Pete,
For your paging to work you need to define number of page for the skip.
int itemsPerPage= 10; // no of pages per pageint page = 1; // viewing pageAnd make use of some QueryString for the paging
if (!int.TryParse(Request.QueryString["page"], out page)){page = 1;}
@foreach(dynamic item in pagesToList.Skip((page-1)*itemsPerPage).Take(itemsPerPage)){}
@for(int p =1; p < totalPages + 1; p++){ string select = (p == page)? "selected": ""; <li ><a href="?page=@p" title="Go to page @p of results">@p</a></li> }
Thanks fuji, I've already got the code you mention in there - I just didn't put it in my post above, I was just highlighting that:
pagesToList = nl.Where(x => x.Name.StartsWith(currentLetter));
creates the object' does not contain a definition for 'Skip' error. on the:
@foreach(dynamic item in pagesToList.Skip(currentPage*itemsPerPage).Take(itemsPerPage))
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Order by first letter?
I'm trying to get some nodes by their first letter, and use the razor paging, briefly using this:
Then for the paging:
But I get a 'object' does not contain a definition for 'Skip' error.
Hi Pete,
For your paging to work you need to define number of page for the skip.
int itemsPerPage= 10; // no of pages per page
int page = 1; // viewing page
And make use of some QueryString for the paging
Thanks fuji, I've already got the code you mention in there - I just didn't put it in my post above, I was just highlighting that:
creates the object' does not contain a definition for 'Skip' error. on the:
is working on a reply...