getting the values from a nested complex object that is passed to a partial view

后端 未结 4 918
感动是毒
感动是毒 2020-11-22 12:32

I have a ViewModel that has a complex object as one of its members. The complex object has 4 properties (all strings). I\'m trying to create a re-usable partial view where

4条回答
  •  无人及你
    2020-11-22 12:57

    If you use tag helpers, the partial tag helper accepts a for attribute, which does what you expect.

    
    

    Using the for attribute, rather than the typical model attribute, will cause all of the form fields within the partial to be named with the ComplexModel. prefix.

提交回复
热议问题