Copied to clipboard

Flag this post as spam?

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


  • Keith Beller 4 posts 24 karma points
    Sep 04, 2012 @ 04:03
    Keith Beller
    0

    Custom Sections not displaying 4.8.1

    Followed instructions on videos but can't seem to get the custom section appTree to load.

    I tried remote debugging my assembly but my breakpoints are not hit. I dont' think the assembly is loading.

    Tried restart iis, update config. etc...no luck.

    My umbracoApp Table has the following entry.

    sortOrder appAlias appIcon appName appInitWithTreeAlias
    99 ministries umbraco-ministries-tray-icon.gif Ministries NULL

    The section loads fine.

    Tray Icon is in the right folder.

    My umbracoAppTree entry looks like this.

    treeSilent treeInitialize treeSortOrder appAlias treeAlias treeTitle treeIconClosed treeIconOpen treeHandlerAssembly treeHandlerType action
    0 1 1 ministries ministries locations folder.gif folder_o.gif bmm.org.Extensions Sections.Ministries.Locations.LoadLocation NULL

    my code looks like this.

    namespace bmm.org.Extensions.Sections.Ministries.Locations
    {
        using umbraco.BusinessLogic.Actions;
        using System.Globalization;
        using System.Text;
        using umbraco.BusinessLogic;
        using umbraco.cms.presentation.Trees;

        public class LoadLocation : BaseTree
        {
            public LoadLocation(string application): base(application){}

            public override void RenderJS(ref StringBuilder javascript){}

            public override void Render(ref XmlTree tree)
            {
                var reader = Application.SqlHelper.ExecuteReader("SELECT * FROM [dbo].[bmmLocation]");

                while (reader.Read())
                {
                    var xNode = XmlTreeNode.Create(this);
                    xNode.NodeID = reader.GetInt("Id").ToString(CultureInfo.InvariantCulture);
                    xNode.Text = reader.GetString("Name");
                    xNode.Icon = FolderIcon;
                    xNode.Action = "javascript:openCountry(" + reader.GetInt("id").ToString(CultureInfo.InvariantCulture) + ")";
                    tree.Add(xNode);
                }
            }

            protected override void CreateRootNode(ref XmlTreeNode rootNode)
            {
                rootNode.Icon = FolderIcon;
                rootNode.OpenIcon = FolderIconOpen;
                rootNode.NodeType = TreeAlias;
                rootNode.NodeID = "-1";
                rootNode.Menu.Clear();
                rootNode.Menu.Add(ActionRefresh.Instance);
            }
        }
    }

    My location table is full of data.

    What am i missing?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Sep 06, 2012 @ 17:53
    Tom Fulton
    0

    Hi Keith,

    So your section is loading but no trees are showing inside of it?

    Your table entries seem to be correct.  In my experience it's very picky about the assembly/class names though.  To simplify things you might try using the new method introduced in 4.8.0, where you decorate your classes with an attribute and don't have to add them to the DB:  http://blog.mattbrailsford.com/2012/07/18/creating-custom-applications-and-trees-in-umbraco-4-8/

    -Tom

Please Sign in or register to post replies

Write your reply to:

Draft