I have a view that contains several partial views with different models, all except one, which has the same model as the parent view. The reason being, parent view represents a Risk, and the partial view is loaded based on whether the Risk is "Motor" or "Non-Motor". Both Motor and Non-Motor partial views use the same model found in the Risk parent view.
I'm using the Html.BeginCollectionItem method and serializing the form data when submitting, in an attempt to retrieve said data in the same class used for the parent view's model (Risk). The submission manages to collect all data except for that found in the Motor and Non-Motor partial views. The goal was for the data in the Motor/Non-Motor partial views to be serialized in the same object as the Risk model in the parent view, however, when I debug the receiving method, all attributes collected in the partial views are either null or 0, although values were in fact entered in the form.
How do I get the Risk item to have all data, rather than just the data entered outside of the partial views?
If you can, please provide code snippets (and additional information as to what you want the parent view & partial views to accomplish) in order for us to get a better understanding of the problem you are facing and provide more accurate answers.
From what I can gather:
Without understanding the business context behind why you are designing the app this way, here are my suggestions: