This project is read-only.

Content editor in Dashboard not showing editor fields

Topics: Customizing Orchard, Troubleshooting, Writing modules
Jan 6, 2012 at 7:21 AM

I created a custom content type with only two fields: Name, and BasicInfo. They are string fields and i see the table and columns are in my db after updating the module via Migrations.cs. I defined the Drivers and Handler exactly as this page describes: I also created /Views/Parts/ShoePart.cshtml and /Views/EditorTemplates/Parts/ShoePart.cshtml . 

I verified in the dashboard that the Shoe content type contains the "ShoePart". But when I click "Create new Shoe", it takes me to ~/Admin/Contents/Create/Shoe , which is a page that just has a "Save" button and nothing else. I expected to see two text entry fields for my part's two properties. 

Editor method in the Driver:

        protected override DriverResult Editor(ShoePart part, dynamic shapeHelper)
            return ContentShape(
                , () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/Shoe"
                    , Model: part
                    , Prefix: Prefix
The Model and record:

    public class ShoePartRecord : ContentPartRecord
        public virtual string Name { get; set; }
        public virtual string BasicInfo { get; set; }

    public class ShoePart : ContentPart
        public string Name
            get { return Record.Name; }
            set { Record.Name = value; }
        public string BasicInfo
            get { return Record.BasicInfo; }
            set { Record.BasicInfo = value; }

                , t =>
                    .Column("Name", DbType.String)
                    .Column("BasicInfo", DbType.String)
            ContentDefinitionManager.AlterPartDefinition("ShoePart", b => b.Attachable());

            ContentDefinitionManager.AlterTypeDefinition("Shoe", cfg => cfg

And ~/Views/EditorTemplates/Parts/Shoe.cshtml:
@model myproj.Models.ShoePart
<fieldset  class="profile-fields">
    @Html.LabelFor(m => m.Name, T("Name:"))
    @Html.EditorFor(m => m.Name)
    @Html.ValidationMessageFor(m => m.Name, "*")
    <br />
    @Html.LabelFor(m => m.BasicInfo, T("Basic Info:"))
    @Html.EditorFor(m => m.BasicInfo)
    @Html.ValidationMessageFor(m => m.BasicInfo, "*")

Hopefully I'm just missing something simple. 

Jan 6, 2012 at 8:42 AM

You forgot placement.

Jan 6, 2012 at 1:40 PM

Ah, it was a typo in Thanks!