how to create a view with multiple models mvc 4?

后端 未结 2 1289
一整个雨季
一整个雨季 2021-01-14 09:00

so i works in asp.net mvc 4 project and i have a problem in my view, what i want is create a view with 2 differnt type of model,first view (Index) take IEnumerable (Models.m

2条回答
  •  情书的邮戳
    2021-01-14 09:34

    You just need to create a second view called Details which is strongly typed with SubscribersModel

    @model _3SDWebProject.Models.SubscribersModel
    

    Right-click anywhere in the code for your Details() action
    Select Add View...
    Leave "Details" for View name
    Check "Create a strongly-typed view"
    Select your SubscribersModel from the Model class dropdown
    Scaffold template: Details
    Click "Add"

提交回复
热议问题