eadam
eadam

Reputation: 26121

N2CMS collection editor in mvc

I have List of strings (List) as a ContentItem property. Which editor should I use to add/edit/delete list items in the editor interface? Please let me know if there are some examples available. I am new to N2 and don't really have an idea at the moment to create my own editor.

Upvotes: 0

Views: 157

Answers (1)

Ben H
Ben H

Reputation: 3236

You can persist this as just a string in the database. In the getter & setter, you would do something like:

List<string> MyProperty {
    get { return new List<string>(GetValue<string>("MyProperty", String.Empty).Split("\n"); }
    set { SetValue<string>(String.Join("\n", value.ToArray()), String.Empty); }
}

Note: I wrote this off the top of my head so the String.Join parameters might be reversed.

Upvotes: 0

Related Questions