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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:34:07+00:00 2026-06-16T03:34:07+00:00

I have a view with strongly typed model view and i need to pass

  • 0

I have a view with strongly typed model view and i need to pass this data to a partial view, in loop. (the partial view is sorta playing role of template for data)

Model:

public class Foo
{

public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }

}

Controller:

public ActionResult Index()
    {
        var foo = new List<Foo>();

        for (var i = 1; i < 3; i++)
        {
            foo.Add(new Foo{Content = "test content " + i, Title = "test title " + i, Id = i});
        }
        return View(foo);
    }

View (Index):

@model List<Project.Models.Foo>
 @foreach (var foo in Model)
    {
        Html.RenderPartial("OneFoo", foo);
    }

View (OneFoo):

@using Project.Models
<div>
    Title:
        @Html.LabelFor(f => f.Title)
        Content:
        @Html.LabelFor(f => f.Content)
    }
</div>

The output I’m getting is: Title: Title, Content: Content – it’s not getting the actual values.

  • 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-06-16T03:34:09+00:00Added an answer on June 16, 2026 at 3:34 am

    You are using the wrong helper, use:

    @Html.DisplayFor(f => f.Content)
    

    or

    @Model.Content
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a strongly typed asp.net-mvc view and the Model has a . Links
I have a view that is not strongly typed. However I have in this
I have a strongly-typed view that receives a Design model for its rendering. My
I use a foreach in my View to loop over my strongly-typed Model and
I have a strongly typed partial view #1, and i have another partial view
I have a view that is strongly typed. Inside this view i have jqueryui
I have a view that is strongly typed to a view model which contains
I have the following MVC2 view that is strongly typed with a viewmodel, the
I have an array in Knockout view model which looks like so: this.Activities =
Ok I have a View thats is strongly typed as a collection of MyObject

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.