I am used to working with ASP.NET FORMS and I am having a hard time understanding MVC.NET.
If I in WebForms would create a profile page for a user, it would consist of an aspx page with several usercontrols added on the page, which all does something differently.
One control might show the latest posts by the user, another the friends connected to the user etc.
But how would this be done in MVC.NET?
Am I supposed to create several views for each user control, or am I supposed to create one huge model which contains all the data I need on the page and then feed it to the view?
For me, if a the partial view (.ascx or usercontrol in asp.net forms) has a lot of dynamic contents on it, I will make it a strongly typed view. Which means it has its own Model. Depending on its usability. But I strongly advise make each Views its corresponding Model.
For example, in this situation, you have a partial view that has a Model of
AddressPartial View
Model
And I want to use this Partial View of mine depending on the page that is using. Could be the Login User or the Friends User. What I would do is just call its Corresponding Action in a Controller.
Say I put it in the
CommonControllerIn this case I can call this Partial View in any Part of any page by
assuming my View that I was calling the Partial View has a Model of User with a property of
AddressId. This way, I can use and reuse my Partial View in 1 single page, each got different content.