1

The project name is MVCMultipleModelTypes

@using MVCMultipleModelTypes.Models
@model Empl...beeeeeeeeepp.....

Does anyone know why i can't access the Models in the View? I loaded the project in Visual Studio 2015 and 2013 and same thing. The other projects work fine.

The pictre should tell the whole story. Can't Access Models

6
  • 1
    Have you tried building your solution and then closing and opening the view again? Commented Aug 10, 2015 at 13:59
  • 1
    Check the namespace of Employee.cs. Probably your intellisense is broken, which didn't mean that mvc can't access models. Commented Aug 10, 2015 at 14:02
  • 1
    Can you show us the definition of Empl...beeeeeeeeepp....., is it public? Commented Aug 10, 2015 at 14:17
  • I did Clean Solution, Rebuild, Closed, Reopen, same thing. Namespace is: namespace MVCMultipleModelTypes.Models { class Employee { Commented Aug 10, 2015 at 14:22
  • Thanks Coulton!! I was loosing my mind! That was the issue. Classes were not public. All good now :) Commented Aug 10, 2015 at 14:25

1 Answer 1

2

Your class needs to be defined as public for you to access it in the view.

public class Employee
{
    public string EmployeeName { get; set; }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.