What controller do I put MVC layout page logic in?
Posted on 2012-03-24
Disclaimer: I'm new to ASP.net MVC
I'm currently trying to convert a few websites from Web Forms over to the MVC 3 design. I having some trouble trying to figure out where I should stick my layout (master page) logic.
I have a Master Page that contains a header, main content, right colum, footer. Currently in my Master Page code behind file in web forms makes a call to my DB and retrieves some data to be displayed in my right column.
My question is: Where does this logic go for my MVC design? Do I have to put the same right column code in every single controller I have for the site? Or, can I stick it somewhere else in one place and call it from the layout page somehow? I dont want to stick the logic in my view since that shouldn't contain any business logic.
Im trying to stick to the MVC paradigm to keep the code a clean and manageable as possible.
I've read a handful of articles about using childactions, but none of those articles tell me where I should stick these child actions.