This project is read-only.

Using ContenPickerField into 1-n relationship table

Topics: Writing modules
Feb 4, 2013 at 2:57 PM
Edited Feb 4, 2013 at 2:58 PM
hi orchard team,
i am implementing a module that should display into tabs some ContentItems (picked by Contentpicker if it's possible...).
I have these tables:
-- TabRecord (1-n with TabsPartRecord)

Now what I need is to attach the ContentPickerField (field and picking functionality) to my TabRecord (that isn't a part but only a record with a "RelatedContentRecord_Id" integer field).

How can I proceed?

My migrations.cs
        public int Create() {
                table => table

                table => table
                    .Column<int>("Id", column => column.PrimaryKey().Identity())
                    .Column<string>("DisplayName", column => column.WithLength(150).NotNull())
                    .Column<int>("Weight", column => column.NotNull())

            return 1;
        public int UpdateFrom1() {

            ContentDefinitionManager.AlterPartDefinition("TabsPart", part => part

            return 2;
Feb 10, 2013 at 8:26 AM
I don't understand. What are you trying to do?
Feb 10, 2013 at 9:01 AM
Edited Feb 10, 2013 at 9:05 AM
I'll try to explain better.

I would create a part that should show on my site other contents (content items) in a jQuery tab.
So what I done was create a jQueryTabs Part (that contains a List<SingleTabRecord>) and a SingleTabRecord with all properties I need.
To do this I follow this article explaining 1-n and n-n relationships in orchard

Now what I am trying to do is to use a ContentPickerField for every SingleTabRecord Listed in my Part in order to re-use all the work done for the ContentPickerField. But I cannot because I cannot use an orchard field (like a contentpickerfield) within my SingleTabRecord.

So what's the correct way to proceed in these cases?
Feb 10, 2013 at 9:21 PM
No, the content item picker field is designed to pick content items, not plain records. You'll have to build your own picker.