views:

131

answers:

3

Basically I just want something like an include control that I can put into the head and also something that could be nested(optional). I want to put the links to the css and js files in there so I have them all in one place. NO MASTERPAGES - I am trying to(read have to) avoid them for this project. User controls work fine for this but I guess it is a weird way to use them and Visual studio does not render them properly in the HEAD section of the page within the editor. That being said I have successfully used user controls for that purpose with no problems. However, I wanted to check with .NET pros here and see if there is something else that would work better.

+1  A: 

Try adding a Placeholder control to the head of your aspx file. A Placeholder does not render any html itself but it does have a ControlCollection to which you can add whatever you like.

Andrew Hare
+1, but you have to understand there are issues with doing this (see http://haacked.com/archive/2009/01/27/controls-collection-cannot-be-modified-issue-with-asp.net-mvc-rc1.aspx)
Will
Nice find - I was not aware of that.
Andrew Hare
A: 

You can use a simulated include file.

Diodeus
A: 

You could also use a literal control as well.