How to render an object tree with paging?

Posted by erikzeta on Stack Overflow See other posts from Stack Overflow or by erikzeta
Published on 2011-02-02T10:44:20Z Indexed on 2011/02/02 15:25 UTC
Read the original article Hit count: 287

Filed under:
|
|

I’ll render an object graph on a page looking like this:

  • Category 1
    • Module 1
      • Product 1
      • Product 2
      • Product 3
    • Module 2
      • Product 4
  • Category 2
    • ...

The Category has an IList<Module> and the Module contains an IList<Product> Now I need to implement paging on this structure but the problem is that I can’t do Category.Skip(page * pageSize).Take(pageSize) because this will only work on the Category object not the whole object tree. In other words I like to render out when the sum of Categories, Modules and Products is equal to the PageSize

/erik

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET