Reputation: 802
Is there a way to access Page.Header.Controls in ASP.NET MVC 2?
I want to create a helper which can manage scripts.
Yesterday, after I asked this question I discovered, that ViewPage and ViewUserControl has Page property.
I think this allows us to access Page.Header.Controls.
Upvotes: 0
Views: 660
Reputation: 9727
No, Page.Header
doesn't exist in ASP.NET MVC. Header
is the <head runat="server>
control in ASP.NET Web Forms. ASP.NET MVC doesn't use controls like that.
If you want logic in the <head>
of your HTML, you have to go about it the ASP.NET MVC way, by using code in your view or your master page.
The Page
property of a ViewPage
comes from the fact that Web Form Views are bastard Web Forms. ASP.NET MVC normally doesn't use any bits of the Web Forms beside the code-in-front and the markup, but via various unsupported haacks you can abuse it into letting you use other Web Forms stuff. Don't do it.
Upvotes: 4