This project is read-only.

Custom module data not saving

Topics: Customizing Orchard
Jul 4, 2012 at 9:58 PM

I created a new module, but on the Publish the data is not being entered into the database.

I am on 1.4.2.

Here is my Views/EditorTemplates/Parts/ProfitTracker.cshtml part:

@using ProfitTracker.Models
@model ProfitTrackerPart

    @Html.LabelFor(m => m.ShortDescription, T("Short Description"))
    @Html.TextBoxFor(m => m.ShortDescription)
    @Html.LabelFor(m => m.TransactionDate, T("Transaction Date"))
    @Html.TextBoxFor(m => m.TransactionDate)
    @Html.LabelFor(m => m.Amount, T("Amount"))
    @Html.TextBoxFor(m => m.Amount)

Then I have this as my driver:

    public class ProfitTrackerPartDriver : ContentPartDriver<ProfitTrackerPart>
        protected override string Prefix
                return "ProfitTracker";

        protected override DriverResult Editor(ProfitTrackerPart part, dynamic shapeHelper) {
            return ContentShape("Parts_ProfitTracker_Edit", () => shapeHelper.EditorTemplate(TemplateName: "Parts/ProfitTracker", Model: part, Prefix: Prefix));

        protected override DriverResult Editor(ProfitTrackerPart part, Orchard.ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
            part.DateEntered = DateTime.Now;
            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);

        protected override DriverResult Display(ProfitTrackerPart part, string displayType, dynamic shapeHelper) {
            return ContentShape("Parts_ProfitTracker", () => shapeHelper.Parts_ProfitTracker(ProfitTrackerPart: part));

On the second Editor override the part does not contain my entered information.

Jul 4, 2012 at 10:43 PM

From what I can tell, may be related... here is my handler:

    public class ProfitTrackerHandler : ContentHandler
        public ProfitTrackerHandler(IRepository profitTrackerPartRepository)

Jul 5, 2012 at 1:09 AM

Figured this out with some trial and error.


Ultimately the log files helped me figure out what I had wrong.