Developer forum

Forum » Development » How do I reference an existing item type in DropDownListEditor?

How do I reference an existing item type in DropDownListEditor?

Peter Terkildsen
Reply

Hi,

I'm creating a new item with the following field:

        [Field("Category", typeof(Dynamicweb.Content.Items.Editors.DropDownListEditor<>))]
        [Required]
        public IList<string> Category { get; set; }

I have an existing item type called Category. How do I reference this item type in the above item field?

Regards,

Peter


Replies

 
Vladimir
Reply
This post has been marked as an answer

Hi Peter,

you should use OptionItemAttribute:

  [Field("Category", typeof(Dynamicweb.Content.Items.Editors.DropDownListEditor<>))]         
  [OptionItem("Category", "nameField", "valuField")] 
  [Required]         
  public string Category { get; set; } 

Best regards,

Vladimir

Votes for this answer: 1
 
Peter Terkildsen
Reply

Nice! Working like a charm...Thanks :-)

Peter

 

You must be logged in to post in the forum