Copied to clipboard

Flag this post as spam?

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


  • Vasiliy 10 posts 50 karma points
    Aug 17, 2013 @ 16:00
    Vasiliy
    0

    Custom backoffice section - unhandled exception

    Hello,

    I create an application in the backoffice. I followed the steps given on umbraco.tv and modifyed the code appropriatelly as I use version 6 (not 4). I managed to create a backend section with the tree populated with one custom node. But when I try to use "Create" method from the section dropdown menu, I get the following error:

    Server error in application /. Value cannot be null. Parameter name: type

    Stack trace:

    [ArgumentNullException: Value cannot be null. Имя параметра: type]

    System.Activator.CreateInstance(Type type, Boolean nonPublic) +9643926

    umbraco.presentation.create.dialogHandler_temp.Create(String NodeType, Int32 TypeId, Int32 NodeId, String Text) +305

    umbraco.cms.presentation.create.controls.simple.sbmt_Click(Object sender, EventArgs e) +220

    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118

    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112

    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36

    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

    Any ideas are greatelly appreciated :)

  • Vasiliy 10 posts 50 karma points
    Aug 17, 2013 @ 16:01
    Vasiliy
    0

    My code is the following:

    LoadCustomTree.cs

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using umbraco.BusinessLogic.Actions; using umbraco.businesslogic; using umbraco.cms.businesslogic.template; using umbraco.cms.presentation.Trees; using umbraco.interfaces;

    namespace CustomUmbracoSection.Trees { [Application("custom", "custom", "custom.gif")] public class ContentApplicationDefinition : IApplication { }

    [Tree("custom", "custom", "Custom", "Applicants_small.gif", "Applicants_small.gif")]
    public class LoadCustomTree : BaseTree
    {
        public LoadCustomTree(string application) : base(application) { }
    
    
    
        protected override void CreateRootNode(ref XmlTreeNode rootNode)
        {
            rootNode.Icon = FolderIcon;
            rootNode.OpenIcon = FolderIconOpen;
            rootNode.NodeType = "init" + TreeAlias;
            rootNode.NodeID = "init";
    
    
        }
    
        protected override void CreateRootNodeActions(ref List<IAction> actions)
        {
            actions.Clear();
            actions.Add(ActionNew.Instance);
            actions.Add(ActionRefresh.Instance);
        }
    
        protected override void CreateAllowedActions(ref List<IAction> actions)
        {
            actions.Clear();
            //actions.Add(ActionRefresh.Instance);
            actions.Add(ActionDelete.Instance);
    
        }
    
        public override void Render(ref XmlTree tree)
        {
    
    
            XmlTreeNode xNode = XmlTreeNode.Create(this);
            xNode.NodeID = "1";
            xNode.Text = "Custom node";
            xNode.Action = "javascript:openCustom('" + "1" + "');";
            xNode.Icon = "doc.gif";
            tree.Add(xNode);
    
        }
    
        public override void RenderJS(ref StringBuilder Javascript)
        {
            Javascript.Append(
               @"
                    function openCustom(id) {
                        parent.right.document.location.href = 'custom/editCustom.aspx?id=' + id;
                    }
                ");
        }
    }
    

    }

Please Sign in or register to post replies

Write your reply to:

Draft