We are currently looking at moving over to using v6 MVC but we have some previous code used which injects controls to a page usually in the head, which I can't find a way of doing with MVC.
System.Web.UI.Page page = HttpContext.Current.Handler as System.Web.UI.Page;
page.Header.Controls.Add(ctrl);
Obviously now with V6 and MVC the context handler is not a Web.UI.Page so debugging it seems to be Umbraco.Web.Mvc.UmbracoMvcHandler" but this has no header available to add controls. Looking at the MVC page class 'System.Web.Mvc.ViewPage' this does have the header available but I can't cast the handler to this.
Does anyone know how this can be done in Umbraco MVC? In know you can use sections and register scripts from views but in this case I need to inject controls from a static class.
Appending controls to Page in V6
Hello,
We are currently looking at moving over to using v6 MVC but we have some previous code used which injects controls to a page usually in the head, which I can't find a way of doing with MVC.
Obviously now with V6 and MVC the context handler is not a Web.UI.Page so debugging it seems to be Umbraco.Web.Mvc.UmbracoMvcHandler" but this has no header available to add controls. Looking at the MVC page class 'System.Web.Mvc.ViewPage' this does have the header available but I can't cast the handler to this.
Does anyone know how this can be done in Umbraco MVC? In know you can use sections and register scripts from views but in this case I need to inject controls from a static class.
Thanks,
John
is working on a reply...