Copied to clipboard

Flag this post as spam?

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


  • Tyler 8 posts 28 karma points
    Dec 09, 2011 @ 17:26
    Tyler
    0

    Adding read/write properties to a new context menu action - Umbraco 4.5.2

    I'm pretty new to Umbraco, but I have been up and down the forum and video tutorials looking for an answer to this problem:  I have created a new Action for the Media context menu called ActionView and it inherits umbraco.interfaces.IAction.  I want to be able to add properties to this class ActionView.  Everything works as expected, except I can't seem to pass a property value to my instance of ActionView. Here is the code within the class:

    private string _path;

    Public string Path{
    get { return _path; }
    set { _path = value; }
    }


    then in BaseTree_BeforeNodeRender:

    ActionView action = new ActionView();
    action.Path = "this is the path";
    node.Menu.Insert(0, action);

     But the problem is that the value I assigned to Path doesn't show up.  If I assign the private string _path a value within my class, that shows up.  I even tried doing this by adding a constructor to my class that takes a string parameter, but when I run the code, it does seem to ever hit that constructor.  It goes to the default constructor, like it isn't rendering my instance of the class.

    Am I missing something? I haven't found a lot of info about passing node property values as properties of a context menu item.  I thought this would be a common need, unless there is a better way of doing this...?

    Thanks,

    Tyler

Please Sign in or register to post replies

Write your reply to:

Draft