c# - Render view dynamically based on model in Asp.net mvc -


i have 2 domain classes , 1 flatclass , other pgclass. based on these 2 have created viewmodel. if user has selected flat radio button ui flatclass populated, otherwise on selection of pg radio button pgclass populated. , on view using viewmodel. is load , pass properties of other class has not selected in viewmodel in view performance point view or can suppress or obselete properties of non- selected class based on condition ?? . don't want create 2 partial views, how render ui based on dynamic selection of model controller in single partial view ?

although best practice use 2 different partial views model. in case want implement single partial view, may create base class inherits both flatclass , pgclass.

now can create single partial view new viewmodel.

public class baseclass {    public flatclass? flat {get; set;}    public pgclass? pg {get; set;} } 

please note both objects nullable, since using 1 of them @ time , other 1 null.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -