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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:34:36+00:00 2026-05-31T10:34:36+00:00

Using Entity Framework 4, MVC3, C# I have created a complex type within the

  • 0

Using Entity Framework 4, MVC3, C#
I have created a complex type within the model of type “SP_Exploder_Result” after clicking Add Function Import.

My controller is as follows:

    public ViewResult Exploder(int id)
    {
        var r = db.SP_PartExploder(id);
        return View(id);
    }

I try and scaffold the view and iterate over the model passed to it:

@model IEnumerable<EM6.Models.SP_PartExploder_Result>
@foreach (var item in Model) {
<tr>
    <td>
        @Html.DisplayFor(modelItem => item.ComponentId)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.Name)
    </td>
    <td>
        @Html.DisplayFor(modelItem => item.Total)
    </td>

The model item passed into the dictionary is of type ‘System.Int32’, but this dictionary requires a model item of type ‘System.Collections.Generic.IEnumerable`1[EM6.Models.SP_PartExploder_Result]’.

Any ideas how I can convert the model obtained by the Controller to the correct type?

  • 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-31T10:34:38+00:00Added an answer on May 31, 2026 at 10:34 am

    Unless I am misunderstanding your question I think that the the variable “r” needs to be passed into the view rather than the int Id.

    At the moment it would appear that the int is being used as the model for the view, rather then the result of your call to db.SP_PartExploder.

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

Sidebar

Related Questions

I am using MVC3 with Entity Framework Code First. I have the following model.
I am using MVC3 and Entity Framework. I have a List on a page
I have a C#-4 MVC3 RC test-application which is using Entity Framework 4. I
I'm working with MVC3, and using Entity Framework 4.0 Entities as my model. So
I have developed a project using MVC3 and Code first Entity Framework 4.0 as
I am building a movie site. I am using mvc3 and entity framework. I
Using Entity Framework, I suddenly get this strange error after publishing my asp.net mvc
I have a small MVC 3 app using Entity Framework Code First and use
I'm setting up a blog using Asp.net MVC3 and Entity framework 4. Most of
We have a simple intranet site in MVC3 and entity framework. Everything works fine

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.