If I debug my controller:
public ActionResult Edit(ShippingCustomerAccountModel model, int id, FormCollection form)
the model properties are null, yet the form (collection) has the values.
My Edit.cshtml has this code which is like that in core's \Views\CustomerAddressEdit.cshtml
@{
var dataDict = new ViewDataDictionary();
//Merge ModelState (required for validation)
dataDict.ModelState.Merge(ViewData.ModelState);
dataDict.TemplateInfo.HtmlFieldPrefix = "Account";
@Html.Partial("~/Plugins/MyPlugin/Views/CustomerAccounts/_CreateOrUpdate.cshtml", Model.CustomerAccount, dataDict)
}
My _CreateOrUpdate has:
<div class="inputs">
@Html.LabelFor(model => model.AccountNumber, new { }, ":")
@Html.EditorFor(model => model.AccountNumber)
@Html.RequiredHint()
@Html.ValidationMessageFor(model => model.AccountNumber)
</div>
This is the emitted html in browser:
<div class="inputs">
<input class="text-box single-line" id="Account_AccountNumber" name="Account.AccountNumber" type="text" value="">
<span class="field-validation-valid" data-valmsg-for="Account.AccountNumber" data-valmsg-replace="true"></span>
</div>
Am I missing something about how TemplateInfo.HtmlFieldPrefix works?