Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Walker 41 posts 136 karma points
    Aug 29, 2013 @ 11:34
    John Walker
    0

    Appending controls to Page in V6 MVC

    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.

    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.

     

    Thanks,

    John

Please Sign in or register to post replies

Write your reply to:

Draft