How to pass model to partial view

后端 未结 3 1158
悲哀的现实
悲哀的现实 2020-12-16 09:06

I have two view models:

public class ParentViewModel
    {
        public Id { get; set; }
        .....
        public ChildViewModel Child{ get; set; }
            


        
3条回答
  •  不思量自难忘°
    2020-12-16 10:05

    The answer is that needs to pass an empty object to Partial, like

    @Html.Partial("_Partial", new ChildViewModel ())
    

提交回复
热议问题