Using partial views in ASP.net MVC 4

后端 未结 2 756
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 09:33

I have recently started playing around with ASP.net MVC (4), but I can\'t wrap my head around this one issue I\'m having. I\'m sure it\'s easy when you know it.

I\'m

2条回答
  •  长情又很酷
    2020-12-04 09:47

    You're passing the same model to the partial view as is being passed to the main view, and they are different types. The model is a DbSet of Notes, where you need to pass in a single Note.

    You can do this by adding a parameter, which I'm guessing as it's the create form would be a new Note

    @Html.Partial("_CreateNote", new QuickNotes.Models.Note())
    

提交回复
热议问题