DISPALY mode; first field not shown

Topics: General, Troubleshooting
Mar 4, 2012 at 1:32 PM

when I'm in 'display' mode the very first field 'Evenement' (also first in the database) is not shown.
when I in 'edit' mode this first field is shown correctly. Needless to say that the db-record is correct also!
I checked the naming in the 'driver', 'model', 'migrations.cs'

ALL other fields are shown correctly! 

views\parts\eve.cshtml

@T("Evenement"): <b>@Model.Evenement</b><br />
@T("Category"): <b>@Model.Category</b><br />
@T("HomeTeam"): <b>@Model.HomeTeam</b><br />

.. etc.

what else do I need to check, thanks for your advise,ed

Developer
Mar 4, 2012 at 2:45 PM

Could you provide some more context please? Such as the content type, driver code. Is 'Evenement' a field attached to some content part? Or is it a property of a content part?

Mar 4, 2012 at 3:49 PM
thanks for your time

'Evenement' is a (Text) field in my DB like all other fields, I added to the 'Content Type: Evenement' the part 'eve'

Hope this answers your question; below the driver and migration code
thanks for your hints, ed
driver code:
using Eve.Models;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement;

namespace Eve.Drivers {
  public class EveDriver : ContentPartDriver<EvePart> {
    protected override DriverResult Display(
        EvePart part, string displayType, dynamic shapeHelper)
    {
      return ContentShape("Parts_Eve",
          () => shapeHelper.Parts_Eve(
            Event: part.Evenement,
            Category: part.Category,
            HomeTeam: part.HomeTeam,
            GuestTeam: part.GuestTeam,
            Date: part.Date, 
            DateToEnroll: part.DateToEnroll,
            TeeTime: part.TeeTime,
            Captain: part.Captain,
            Change: part.Change,
            Comment: part.Comment));
    }

    //GET
    protected override DriverResult Editor(EvePart part, dynamic shapeHelper)
    {
      return ContentShape("Parts_Eve_Edit",
          () => shapeHelper.EditorTemplate(
              TemplateName: "Parts/Eve",
              Model: part,
              Prefix: Prefix));
    }

    //POST
    protected override DriverResult Editor(
        EvePart part, IUpdateModel updater, dynamic shapeHelper)
    {
      updater.TryUpdateModel(part, Prefix, null, null);
      return Editor(part, shapeHelper);
    }
  }
}
Migration.cs:
namespace Eve {
    public class Migrations : DataMigrationImpl {

        public int Create() {
			// Creating table EvePartRecord
			SchemaBuilder.CreateTable("EvePartRecord", table => table
				.ContentPartRecord()
				.Column("Evenement", DbType.String)
				.Column("Category", DbType.Double)
				.Column("HomeTeam", DbType.String)
				.Column("GuestTeam", DbType.String)
				.Column("Date", DbType.DateTime)
				.Column("DateToEnroll", DbType.DateTime)
				.Column("TeeTime", DbType.String)
				.Column("Captain", DbType.String)
				.Column("Change", DbType.String)
				.Column("Comment", DbType.String)
			);
            return 1;
        }
        public int UpdateFrom1() {
            ContentDefinitionManager.AlterPartDefinition("EvePart",
            builder => builder.Attachable());
        return 2;
        }
        public int UpdateFrom2() {
        ContentDefinitionManager.AlterTypeDefinition("Evenement", cfg => cfg
            .WithPart("CommonPart")
            .WithPart("RoutePart")
            .WithPart("BodyPart")
            .WithPart("EvePart")
            .WithPart("CommentsPart")
            .WithPart("TagsPart")
            .WithPart("LocalizationPart")
            .Creatable()
            .Indexed());
        return 3;
        }
    }
}

Developer
Mar 4, 2012 at 4:25 PM

Hi Ed, thanks for showing the code.

I think I see the problem. From your driver, you create a shape with a property called "Event".

However, from your shape template, you expect a property called "Evenement". Which does not exist, as no such property has been defined on your shape from the driver.

Mar 4, 2012 at 6:32 PM

ooops and bingo  .... but thanks for your time!

... oneself sometimes becomes blind!