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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:33:02+00:00 2026-06-13T15:33:02+00:00

I am trying to add a partial view to my MVC4 web application and

  • 0

I am trying to add a partial view to my MVC4 web application and I receive the following exception:

The model item passed into the dictionary is of type ‘…Meeting’, but this dictionary requires a model item of type ‘System.Collections.Generic.List`1[…UserProfile]’.

what I did so far:

  1. i added to my controller this function:
public PartialViewResult GetUsers()
        {
            var usersList = (from users in db.Users select users).ToList();
            return PartialView(usersList);
        }
  1. I added the parital view:
@model List<UserProfile>
@{
 <select id="Meeting_SetToUser" name="Meeting.SetToUser">
        @foreach (var item in Model)
        {
            <option value="@item.UserId">@item.FirstName @item.LastName</option>
        }
    </select>
}
  1. i called the partialview from my view:
@Html.Partial("GetUsers")

can you please direct me to were I am doing anything wrong?

Thank you!

  • 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-13T15:33:03+00:00Added an answer on June 13, 2026 at 3:33 pm

    The GetUsers action doesn’t seem to ever be called when you use Html.Partial. Maybe you wanted to use a child action:

    @Html.Action("GetUsers")
    

    Checkout the following article to better understand the difference between Html.Partial and Html.Action.

    Also generating a dropdown list using a foreach loop instead of using the Html.DropDownList helper seems quite inappropriate. Maybe you wanted to use this helper, didn’t you:

    @model List<...UserProfile>
    @Html.DropDown(
        "Meeting.SetToUser", 
        new SelectList(
            Model.Select(x => new 
            { 
                UserId = x.UserId, 
                FullName = string.Format("{0} {1}", x.FirstName, x.LastName) }
            ),
            "UserId", 
            "FullName"
       )
    )
    

    I would also very strongly recommend you using view models instead of passing your domain models to the views.

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

Sidebar

Related Questions

I'm currently trying to add an MSChart to a partial view in ASP.NET MVC
I am trying to add a jqGrid to a ASP.NET MVC3 partial view. This
I am trying to add validation logic into my application. I have tried to
So I'm trying to add a partial view to my main view in MVC3,
I`m trying to add autocomplete to a field that is included in a partial
I was trying to add some non-production test code by creating a 3rd partial
I'm trying add data triggers to the default combobox style so each text item
Im new to asp.net mvc. I'm trying add new model class but it got
I am trying to upload images via a form which sits in partial view
I'm trying to use MVC2 client-side validation in a partial view that is rendered

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.