Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 911761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:15:54+00:00 2026-05-15T17:15:54+00:00

For example, this list contains an overview of documents and needs to allow paging.

  • 0

For example, this list contains an overview of documents and needs to allow paging.
The list is used throughout the website.

Depending on the context where it is used, it needs the data from a different source. For example, it can be used on a ‘group’ page, where it needs to load the documents for the group. And it can be used on an ‘event’ page, where it needs to load the documents for the event.

Both situations can also have different filtering on the documents withing the page.

Should the list not have different datasources, I could easily use Html.RenderAction, and start working from there.

But do I supply the list with documents in the caller, or should the list load the documents, depending on filter/paging/… viewdata?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:15:55+00:00Added an answer on May 15, 2026 at 5:15 pm

    You could implement the list as a partial view instead of a controller action. Then you can use RenderPartial to render the list and pass in a different list of objects depending on what the list should display.

    If you pass in an IEnumerable as a model for example you can implement paging using something like Model.Skip(page * pagesize).Take(pagesize)

    updated

    Let’s not do paging in the view. It might be a better idea to create a model class that does the paging and is actually testable and pass that into the view to serve up the right page of documents. Of course the view is still responsible for showing pages and linking to other pages.

    You could create something like a DocumentPager class that wraps an IEnumerable and that does paging. This would look something like this

    public class DocumentPager {
        public IEnumerable<MyDocumentObject> DocSource { get; private set; }
        public int PageSize { get; private set; }
    
        public DocumentPager(IEnumerable<MyDocumentObject> docSource, int pageSize) {
            DocSource = docSource;
            PageSize = pageSize;
        }
    
        public IEnumerable<MyDocumentObject> GetPage(int pageNumber) {
            return DocSource.Skip(..etc).Take(..etc);
        }
    
        public int NumPages {
            get { return DocSource.Count() / PageSize; }
        }
    }
    

    You can then pass this into the view and into your partial view that can call the GetPage and NumPages method and property.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to the documentation , List.contains can throw NullPointerException in this scenario: if the
How can I generate the shortest sequence with contains all possible permutations? Example: For
I have an ordered (i.e. sorted) list that contains dates sorted (as datetime objects)
I have List collection that is populated in specific order (the requirement is that,
In java application I use hibernate criteria queries, for example: Criteria criteria = session.createCriteria(Any.class);
Java doesn't pass variables by reference. In that case, how do data structures like
I have a contact manager program that I'd like to design for multiple network
GWT's serializer has limited java.io.Serializable support, but for security reasons there is a whitelist
Newbie question... The objective: I intend to have an HTML text input field as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.