MVC5 Asp.net Is there a way to get the correct value from EditorFor for a subclass

后端 未结 2 1690
伪装坚强ぢ
伪装坚强ぢ 2021-01-28 12:56

I have a class

public class Citizen
{
    public long ID { get; set; }
    public string Name { get; set; }
    public long CityID { get; set; }
    public stri         


        
2条回答
  •  礼貌的吻别
    2021-01-28 13:22

    Your code is creating multiple forms which is not good. The best way to handle this kind of scenario is the use of EditorTemplates. Checkout this link on how to do it. EditorFor() for a List of Complex Type (MVC)

提交回复
热议问题