This project is read-only.

No attribute implementing IDisplayable found on the property

Topics: Developer Forum
Apr 6, 2009 at 11:37 AM
Hi all, my slow progress with N2 continues.. I tried to add an extra property a news list I am working on (I call her NewsPanel).

The idea was to have a display option for simple or advanced display in the control/part on the page. I added this code:

[Definition("News Panel", "RB_NewsPanel", "A news panel that can be displayed in a column.", "", 160)]
    [WithEditableTitle("Title", 10, Required = false)]
    [Template( "~/Templates/UI/Parts/NewsPanel.ascx" )]
    [ReplacesParentDefinition]
    public class RBNewsPanel : NewsList
    {
        public enum DisplayOption
        {
            Simple = 1,
            Advanced = 2
        }

        [EditableEnum( "Display Options", 90, typeof( DisplayOption ) )]
        public virtual int DisplayOptions
        {
            get { return (int)( GetDetail( "DisplayOptions" ) ?? 1 ); }
            set { SetDetail( "DisplayOptions", value, 1 ); }
        }

        // override the TitleLevel so it is not used.
        public override int TitleLevel
        {
            get { return 0; }
            set { }
        }
    }

It seemed to work a charm at first, which I was pleased with. But when I started looking at N2 again last night and opened up my site I get the error:

No attribute implementing IDisplayable found on the property 'DisplayOptions' of the item #69 of type Life.Items.RBNewsPanel

I don't understand how I've managed to break this, I used the News List's heading level code as a sample for my own. The stack trace is pretty much useless to me too :(

Please help.
Apr 6, 2009 at 7:43 PM
Do you have an <n2:display propertyname="DisplayOptions" on your template? Try adding [Displayable(typeof(Literal), "Text")] to the property.
Apr 8, 2009 at 9:54 AM
I did indeed. Thanks :(