Take the 2-minute tour ×

I was programming in Zend Framework and now I am also using ASP.NET MVC.

What I liked in Zend Framework is that the layout (something like Master page in ASP.NET world) is rendered AFTER the main content, so you can use html helper to insert javascript or require some css/js files while generating the main content and than the html helper will place all necessary code in head tag which is usually placed in layout (Master page). Is something like that possible in ASP.NET MVC?

share|improve this question

3 Answers 3

If I understand what you are asking correctly, you can put a content placeholder within the head tag on the master page. This lets you inject anything you like from your content pages.

share|improve this answer
Yes that is true, but imagine you would want to render UserControls on your page and each requires some piece of css or js, than you cannot access the "head" placeholder from them or am I missing something? –  Steve Jul 18 '09 at 18:51
Without knowing your precise context, if you know you are putting a certain control on a page you can include the javascript and CSS required for the control through the page rather than the user control. For me, these often aren't separate files anyway as it is quicker for the browser to download few large files than several smaller ones, so it's a bit of a non-issue. –  Garry Shutler Jul 18 '09 at 19:40
Also agree, I know that there ase these possibilities, but I liked the concept of ZF. Other example: the UserControls may generate this javascript dynamically or the imaginary site is complex portal with lots of widgets that are rendered using UserControl dynamically according to user settings. (Of course you can have one big javascript file with all script) –  Steve Jul 18 '09 at 19:50

core meaning is just in two step this process happens.. example to create circle using radius: in first step takes the parameters like radius and read radius now it create screen on basis of radius now in second step of view ... render a screen and convert or render that screen in html

that is html of circle or whatever this is just example on this basis two step view works..

share|improve this answer

You can use the ScriptManager and ScriptManagerProxy controls with the Page.ClientScript property to organize client script on your site.

Scott Hanselman's recent blog post outlines some interesting ways to combine scripts for performance.

share|improve this answer

Your Answer


