c# - Using Partial View on 2 Differently Typed Views -


I have a partial view that I would like to use on 2 different striped-typed scenes. The data being passed is just a simple ID integer, but when I try to present the data on # 2, then I

the model item type in the dictionary CMESurvey .ViewModels.SurveyParticipantViewModel , but this dictionary requires a model object CMESurvey.Models.SurveyProgramModel .

Here is a partial view code that errors:

  @ Html.Partial ("SurveyProgramSubNav", new {ProgramId = Model.ProgramId})   

This code is typed differently with a partial view Strong type:

  @ Model CMESurvey.Models.SurveyProgramModel   

For partial view, and:

  @ Model CME Shrine. View Models. See survey paperspaceModel   

Any help is appreciated for the view that I am having trouble.

I think you want:

  @ Html Partial ("SurveyProgramSubNav", new survey programmodel {ProgramID = Model.ProgramId})   

Specify the strong type of model instead of automatic type.

Comments