Copied to clipboard

Flag this post as spam?

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


  • Steven Lemmens 30 posts 71 karma points
    Jul 28, 2013 @ 14:35
    Steven Lemmens
    0

    Custom Section: can't create a new Node

    I've followed Tim's guide on Umbraco.tv to create a new Section, in Umbraco 6.1.3. Besides the fact that I now have to use the [Tree] Attribute and the [Application]-attribute, I followed his example perfectly.

    The custom section appears and my content nodes are being loaded correctly.

    I then followed his advice on creating a 'Tasks' class that contains the logic for adding and deleting a new item and hooked it up in the UI.xml.

    When I use the 'Create' or the 'Delete' method, I get the following exception:

    Value cannot be null.
    Parameter name: type

    at: System.Activator.CreateInstance

    So I guess it's trying to load my custom Tasks-class and fails.

    My UI.xml contains the following code:

    <nodeType alias="BadgerTree">

    <header>Badger</header>

    <usercontrol>/create/simple.ascx</usercontrol>

    <tasks>

    <create assembly="Badger.Core" type="BadgesTasks" />

    <delete assembly="Badger.Core" type="BadgesTasks" />

    </tasks>

    </nodeType>

    The reference to the assembly is the name of my DLL file, and the BadgesTasks-class does implement ITaskReturnUrl.
    I've also tried fulling qualifying my classname with the correct namespace, to no avail.

    This is the code of my BadgerTasks: nothing much really as it just uses a repository to save/delete

     public class BadgesTasks : ITaskReturnUrl

        {

            private BadgeController _repository;

            public BadgesTasks()

            {

                _repository = new BadgeController();

            }

     

            private string _returnUrl;

            public string ReturnUrl

            {

                get

                {

                    return _returnUrl;

                }

            }

     

            public string Alias { get; set; }

            public int ParentID { get; set; }

            public int TypeID { get; set; }

     

            public bool Delete()

            {

                return _repository.Delete(ParentID);

            }

     

            public bool Save()

            {

                Badge b = new Badge();

                b.Name = Alias;

     

                b = _repository.Save(b);

     

                _returnUrl = "plugins/editBadge.aspx?id=" + b.Id.ToString();

     

                return true;

            }

     

            private int _userId;

            public int UserId

            {

                set { _userId = value; }

            }

        }

     

    Can anyone see what I'm doing wrong or does anyone have any ideas on what I could try?

    Thanks a million!

Please Sign in or register to post replies

Write your reply to:

Draft