I am using a generic template inside the dialog for editing the grid row item.
it looks like this -
@using (Html.BeginForm()){
@Html.EditorForModel()
}
My model has a Editor Template that looks like this -
<fieldset>
<legend>Environment</legend>
<div>@Html.EditorFor(m=>m.Id)</div>
<div>
<div>
@Html.LabelFor(m=>m.Name)
</div>
<div>
@Html.EditorFor(m=>m.Name)
</div>
</div>
<div>
<div>
@Html.LabelFor(m=>m.AccountId)
</div>
<div>
@Html.EditorFor(m=>m.AccountId)
</div>
</div>
<div>
<div>
@Html.LabelFor(m=>m.ContactId)
</div>
<div>
@Html.EditorFor(m=>m.ContactId)
</div>
</div>
<div>
<div>
@Html.LabelFor(m=>m.ExternalId)
</div>
<div>
@Html.EditorFor(m=>m.ExternalId)
</div>
</div>
</fieldset>
And the AccountId inside that template has an EditorTemplate that looks like this -
@Html.DropDownList("Account", new SelectList(MyClass.GetAccounts(), "Id", "Name", Model), new { id = "AccountId", name = "AccountId" })
You can see that I added the html attributes "id" and "name".
The problem I am having, is that form values are not being added to the object when it's deserialized. The "name" attribute looks like AccountId.Account and the "id" attribute looks like AccountId.AccountId.
I added the html attributes to try matching the correct values manually, but the "name" attribute doesn't stick.
Is this a bug?