Copied to clipboard

Flag this post as spam?

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


  • Julien Morvan 8 posts 39 karma points
    Nov 05, 2014 @ 22:02
    Julien Morvan
    0

    Umbraco 7 umbracoPage.Init not fired

    Hello,

    In my ApplicationEventHandler I registered umbracoPage.Init but whatever i try the handle is never called.

    I could find any example to use it with 7.

     

    Any Ideas?

  • Julien Morvan 8 posts 39 karma points
    Nov 07, 2014 @ 08:51
    Julien Morvan
    0

    Some more code to give you an idea on whats happening...

    Breakpoint is hit in the ApplicationStarted but never goes to umbracoPage_Init.

    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                umbraco.presentation.masterpages.umbracoPage.Init += umbracoPage_Init;
            }
    
    void umbracoPage_Init(object sender, EventArgs e)
            {
                // make sure the page is an umbracoPage; otherwise exit
                var page = sender as umbraco.presentation.masterpages.umbracoPage;
                if (page == null)
                    return;
    
                // check that the path is allowed
                var path = page.Page.Request.Path.ToLower();
                if (!path.Contains("umbraco"))
                    return;
    
                // attempt to find/create the ClientDependency loader for the page
                bool created;
                var loader = UmbracoClientDependencyLoader.TryCreate(page, out created);
                if (loader != null)
                {
    
                    // set the custom path for your plugin
                    loader.AddPath("DTPicker", IOHelper.ResolveUrl("~/js/bsDateTime"));
    
                    // load the JavaScript resources
                    loader.RegisterDependency(998, "datetimepicker.css", "DTPicker", ClientDependency.Core.ClientDependencyType.Css);
                    loader.RegisterDependency(999, "datetimepicker.js", "DTPicker", ClientDependency.Core.ClientDependencyType.Javascript);
                }
            }
    
  • Julien Morvan 8 posts 39 karma points
    Nov 11, 2014 @ 00:08
    Julien Morvan
    0

    Anyone? up?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies