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
2009-02-06 16:22:45
+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
2009-02-06 16:28:09
Nice find - I was not aware of that.
Andrew Hare
2009-02-06 17:02:14