Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nick Lewis 30 posts 138 karma points
    Apr 14, 2012 @ 01:22
    Nick Lewis
    0

    Pagination of DynamicModel.Children - how can I do it?

    How can I paginate the results of:

    @foreach (var f in DynamicModel.Children) {
    

    I have tried using Take, Skip etc but none of them work. I would like to paginate the above iteration. How can I go about it?

  • Grant Thomas 291 posts 324 karma points
    Apr 14, 2012 @ 15:14
    Grant Thomas
    0

    Which version of Umbraco are you using? Also, it would be useful to see what you have tried with Take and Skip, since I would be inclined to offer this (if support is available - did you get errors, no output?):

    var nodes = DynamicMode.Children;
    var pageNodes = nodes.Skip(index).Take(count);
    foreach (var node in pageNodes) {

    Where `index` and `count` would come from, say, the query string, or however else you're managing that.

  • Nick Lewis 30 posts 138 karma points
    Apr 15, 2012 @ 00:04
    Nick Lewis
    0

    Thanks Grant. 

Please Sign in or register to post replies

Write your reply to:

Draft