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

I have a list within a data frame (in this example, df$candpct ), and
For example, we have Book List page. This Page contains list of books. If
urls = ['http://www.doopa.pl/1','http://www.doopa.pl/2', 'http://www.dupa2.pl/4/php.pl', 'http://www.dupa3.pl/4/php?gfdgfd=44', 'www.dupa4.pl/4/php.pl'] This example list contains two urls on the
I am looking at this example: List<Product> products = Product. GetSampleProducts() ; products.Sort( (first,
Now this is example list : List<List<KeyValuePair<string, double>>> dblWordFreqByCluster = new List<List<KeyValuePair<string, double>>>(); What
considering this example: public static void main(final String[] args) { final List<String> myList =
Currently, this example shows an unordered list with 8 list items in it. Is
I have an array list of objects and I am using this example to
how to sort a list in Scala by two fields, in this example I
I find it annoying that I can't clear a list. In this example: a

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.