This project is read-only.

Looping through user created pages and place links in the footer

Jul 2, 2012 at 3:43 PM


Im looking to loop through all user created pages and place a link to them in the footer. My problem is i cant see any controller where I can pull the data out the database and send it through to the view.





Jul 2, 2012 at 3:47 PM

Hi Nicholas,

What do you mean by "user created pages"?

Could you put a sample using the sample forums:

In which page would you like to see the links on the footer?




Jul 2, 2012 at 3:54 PM

sorry i mean pages created in the admin interface that have the 


type url

ive found the template that is being printed out to

<p class="requiredLinks">
    @Html.ActionLinkLocalized("About", "Detail", "PageContents", new{name="about"}, null) | 
    @Html.ActionLinkLocalized("Terms and conditions", "Detail", "PageContents", new{name="terms"}, null)

inside FooterContent.cshtml

Jul 2, 2012 at 4:07 PM
Edited Jul 2, 2012 at 4:07 PM


You are right, FooterContent.cshtml is the partial view that is rendered on the footer on every page (with or without having templates enabled).

If you are looking for a built in way to access all the "PageContent" on a view, there isn't: All the PageContents are not loaded on every page, so you can access it on the common view.

If you are looking for a way (overriding the behaviour / forking the solution) to do it: As this partial view is used on every view, you must load it for every request -> Use the BaseController (every controller is a derived BaseController) or an ActionFilter (and register it on the global.asax).


Hope it helps,


Jul 2, 2012 at 4:14 PM

Brilliant, ill give that a go, thanks for the help and the code, i have learnt loads working with it!!