Copied to clipboard

Flag this post as spam?

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


  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 15:33
    Jonathan Saxon
    0

    Custom tree not rendering.

    Got a custom tree that refuses to render code for tree can be found below, this is very simple at the moment as I have stripped it back.

    namespace Utilix
    {
        public class loadMaintenance : BaseTree
        {
            private IUtilixService _service;

            public loadMaintenance(string application) : base(application)
            {
                _service = new UtilixService(new DefaultCacheProvider(), new UtilixRepository());
            }

            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.Icon = FolderIcon;
                rootNode.OpenIcon = FolderIconOpen;
                rootNode.NodeType = "init "+ TreeAlias;
                rootNode.NodeID = "init";
            }

            public override void Render(ref XmlTree tree)
            {
     
                var nodes = _service.FindSections();

                foreach (var n in nodes)
                {
                    var node = XmlTreeNode.Create(this);
                    node.NodeID = n.Id;
                    node.Text = n.Text;
                    node.Action = n.Action;
                    node.Icon = n.Icon;
                    tree.Add(node);
                }
               
            }

            public override void RenderJS(ref System.Text.StringBuilder Javascript)
            {
                Javascript.Append(
                    @"
                        function openUtilix(id)
                        {
                            parent.right.document.location.href = 'plugins\utilix\dashboard.aspx?id='+id;
                        }
                    ");
            }
        }
    }

    umbracoApp

    9, utilix, utilix.gif, Utilix, NULL

    umbracoAppTree

    False,True,0,utilix,functions,Functions,legacy,legacy,Utilix,loadMaintenance, NULL

    Have tried all sorts to get this working it appears as though the Class is never called.

    Please Help

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 15:48
    Matt Brailsford
    0

    Hi Jonathan,

    Are you able to get your custom section to display? If not, you may need to give your user access to that section. Go to the user section, and click on your user account, then ensure you have given that account access to your new section.

    Cheers

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:08
    Jonathan Saxon
    0

    Hi Matt

    Section shows fine, also if I call one of the other trees for instance loadUsers from the umbraco assembly, they load fine.

    Thanks

    Jonathan

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 16:14
    Matt Brailsford
    0

    Hey Jonathan,

    Have you added breakpoints in your code to a) see if the code gets called at all, and b) to make sure _service.FindSections() is actually returning anything?

    Many thanks

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:20
    Jonathan Saxon
    0

    Hi Matt,

    I have added breakpoints seems to never get called, I have also tried to just add a hardcoded node to the Render method but get the
    same result.

    Thanks

    Jonathan

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 16:22
    Matt Brailsford
    0

    And your Utilix.dll is in the bin folder? (Sorry for all the simple questions, but I need to eliminate them first)

    Cheers

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:29
    Jonathan Saxon
    0

    Matt

    The Utilix.dll is in the bin folder.

    Thanks for your help.

    Jonathan

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 16:31
    Matt Brailsford
    0

    Hmm, the class itself looks fine, and the fact that nothing is loading at all would suggest it's a problem creating the tree. Have you had a look in the umbracoLog table to see if there is anything suspicious?

    Cheers

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:33
    Jonathan Saxon
    0

    Matt

    The Utilix.dll is in the bin folder.

    Thanks for your help.

    Jonathan

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:46
    Jonathan Saxon
    0

    Sorry for the double post, there is nothing in the umbracoLog table that relates to this.

    Cheers

    Jonathan

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 16:51
    Matt Brailsford
    0

    Have you tried restarting your app pool?

    Cheers

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:53
    Jonathan Saxon
    0

    Matt just out of interest could there be some sort of cache issue, I was using WebMatrix just because it
    was quicker to setup.

    After all the frustration I decided to make a copy of the site and have run it under IIS and low and behol
    it started to work.

    Thanks

    Jonathan

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 16:56
    Matt Brailsford
    0

    I reckon it was the fact the app pool restarted (ie, by setting it up in IIS, the app pool will have started a fresh anyway). I'd imagine the list of trees is stored internally, so if you defined your tree after the list was populated, it wouldn't get found (my best guess anyway).

    Glad you've got it working though.

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 16:58
    Jonathan Saxon
    0

    Matt plott thickens had it working after moving to iis however changed the name of the tree in umbracoAppTree and the alias and now
    it doesn't work.

    I have then tried to change the name back and it still doesn't work.

    Regards

    Jonathan

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 17:04
    Matt Brailsford
    1

    It's important to understand how the treeHandlerAssembly and the treeHandlerType work together. When Umbraco looks for a tree, it looks for an assembly named "treeHandlerAssembly.dll" (where treeHandlerAssembly is what you entered into the treeHandlerAssembly column of umbracoAppTree), it then looks for a class inside that DLL named "treeHandlerAssembly.treeHandlerType" (note, it constructs the class name by combining the treeHandlerAssembly and treeHandlerType together), so you need to be carefull with your naming around these.

    Beyond that, it does sound like it is caching somewhere. I'd recommend restarting your app pool after making changes, and maybe also clearing your ASP.NET Temporary Files folder.

    Cheers

    Matt 

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 17:05
    Jonathan Saxon
    0

    I have now tracked down the issue, I have no idea why it is an issue though.

    I had a Ninject Module defined in the utilix project as I was attempting to use dependency injection
    for the services, repositories etc.

    If I comment this out the tree works however if I uncomment the tree fails, this is really weird as the module
    is not accessed from anywhere at the moment.

    Jonathan

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 02, 2011 @ 17:07
    Matt Brailsford
    0

    Interesting, I'd have never have guessed that =)

    Good luck with getting the rest working, but glad you've now got your tree displaying.

    Matt

  • Jonathan Saxon 59 posts 86 karma points
    Sep 02, 2011 @ 17:09
    Jonathan Saxon
    0

    Thanks for the help hope I can return the favour one day.

    Jonathan

Please Sign in or register to post replies

Write your reply to:

Draft