c# mvc model vs viewbag

后端 未结 5 1253
滥情空心
滥情空心 2020-12-20 12:36

Suppose you have a list of People A and a list of People B in a page. And these two are seperate classes in L2S, representing two different tables. Therefore, you cannot pas

5条回答
  •  旧时难觅i
    2020-12-20 13:15

    Your first and third options seem both OK.

    ad 1) "only using them once" is not a good argument-against. Use Partial views to organize views.

    ad 2) Use the Viewbag to add small items like a lookup list.

    ad 3) ViewModels are (becoming) common in MVC. This is probably the best approach.

提交回复
热议问题