Working with multiple content holders in MVC

Hi I have a home page in MVC with multiple content holders like:

news list, cart preview, offers, etc. and these are the things I want to be throughout the whole application, but this is my first MVC application and I was wondering if you guys have any sound advice on how to deal with multiple content, from multiple (pages / code) without having to reproduce the code for each controller.

I'm trying to tilt my head around the views and maybe every section as a view so the viewnews will have contentplaceholderid = "newsholder" and so on, but I don't know if that's the right fit for that, or how to use that in a controller, since I'm all anyway want it on url of say / product / 1

in any case, we look forward to your reply

thanks

0


a source to share


1 answer


ContentPlaceholders is the material you want to replace on 99% of your pages.



If you want semi-generic content across multiple pages you want to look at UserControls and Html.RenderPartial (I'll try to find a better link).

+1


a source







All Articles