How can I reuse a DropDownList in several views with .NET MVC

后端 未结 13 1082
感动是毒
感动是毒 2020-12-13 15:53

Several views from my project have the same dropdownlist...

So, in the ViewModel from that view I have :

public IEnumerable Fo         


        
13条回答
  •  独厮守ぢ
    2020-12-13 16:11

    You could put that fetch in the default (null) constructor of MyVM if you don't need to vary its content.

    Or you could use a PartialView that you render into the views that need t.

提交回复
热议问题