Show different sub-sets in edit view

Posted by Martin R-L on Stack Overflow See other posts from Stack Overflow or by Martin R-L
Published on 2010-04-29T18:38:58Z Indexed on 2010/04/29 18:47 UTC
Read the original article Hit count: 373

Filed under:
|

In the context of C# 4, ASP.NET MVC 2, and NHibernate; I've got the following scenario:

Let's assume an entity Product that have an association to ProductType.

In a product edit view; how do I implement that only a sub-set of the product's properties are shown in an elegant and DRY way?

Use a product view model builder, and from different view models automagically generate the view with my own Html.EditorForModel() (including drop-downs and other stuff not out-of-the-box)?

Attribute the properties of one view model and use the Html.EditorForModel() way aforementioned?

Use one model, but implement different web controls (view strategies) (can it be done DRY?)?

Something else entirely?

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc