Click here to Skip to main content
15,940,246 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am new to MVC. I am working on a sample project. Please see my below scenario and provide me a solution.

In my project I have two types pf login. In First type I have the following menu.
Home, New Questions, Read Existing Questions, Answer Questions, About US

In the next Login I have few of the above details like, I have below options
Home, New Questions, About US

Do i have to use different layout page or is any way to use same layout page for both the login.

I tried by having the partial view in layout page, But I got an error says that there is a module XXX and partial view has module YYY. Please see the below error.

The model item passed into the dictionary is of type 'MVCTMS.Models.EnrollmentInfo', but this dictionary requires a model item of type 'MVCTMS.Models.EnrollmentTablink'.

please help me with this.

Thank You

I usually use only one layout file.

The error you posted means that your view is expecting a model of type EnrollmentTablink but you are passing a model of type EnrollmentInfo from wherever you are calling your view.

I don't know how your models look like, but to start with, you could try using the same models.

You can try reading this to get a better understanding of models and views in ASP.NET MVC[^]
Share this answer
I think you create strongly type partial view with EnrollmentTablink Model, you need to create object of EnrollmentTablink Model in EnrollmentInfo Model and now you call partial view like

you need to

Public Class EnrollmentInfo()
  Public EnrollmentTablink enrollmentTablink{get;set}
  Public EnrollmentInfo
     enrollmentTablink= new enrollmentTablink();
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900