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 117265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:18:32+00:00 2026-05-11T03:18:32+00:00

On my start page, I’d like to display the first items from several different

  • 0

On my start page, I’d like to display the first items from several different lists that I have on other pages – somewhat like the ‘recent’ page here on SO displays both recent posts and recent comments. In my case I want to list the two most recent posts in a guest book, and the next upcoming event.

In order to do this, how can I pass several Model objects to my View? Is it even possible? If not, how should it be done?

  • 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. 2026-05-11T03:18:32+00:00Added an answer on May 11, 2026 at 3:18 am

    An alternative to tvanfosson’s solution is to create a strongly-typed view so that you get cvompile-time checking and less ‘magic strings.’

    Example…

    Assume you have the class:

    public class FrontPageViewData {     public List<Post> Posts { get; set; }     public List<Comment> Comments { get; set; } } 

    Then in your controller…

    public ActionResult Index() {     FrontPageViewData viewData = new FrontPageViewData();     viewData.Posts = DB.Posts.ToList();     viewData.Comments = DB.Comments.ToList();     return View(viewData); } 

    And, finally… in your view. This will allow you to access the passed in view data with intellisense if you setup the view registration line up to use it (notice the part. This means the Model property will be an instance of the passed in viewdata argument into the VIew method in your controller.

    <%@ Page Title='' Language='C#' MasterPageFile='~/Views/Shared/Site.Master' Inherits='System.Web.Mvc.ViewPage<FrontPageViewData>' %> <asp:Content ID='MainContent' ContentPlaceHolderID='MainContent' runat='server'> <%= Model.Posts.Count().ToString(); %> <%= Model.Comments.Count().ToString(); %> </asp:Content> 

    Of course this is just a demo and I wouldn’t use this code verbatim.

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

Sidebar

Related Questions

I have a start page on my application that is just a QWebView widget
I'd like to use a RichTextBox to display some text in the start page
I really don't like the VS2008 Start Page. I don't need the RSS reader,
I have a page where when some operation goes wrong i want to start
i have closed the Start Page in FB4 and now i can not find
I have a web app with a start page composed of various links. I
I've created a start page that loads when the application is run but it
On my website's Start page I have a Search Mask where user set select
Ok, I had VS2010 Start Page set up to display 20+ projects in the
I have made small web-app in jsp with a start page with login and

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.