You need to create a editor template for a Attribute
and then pass the List<Attribute>
model to it.
@Model Attribute
<div class="editor-label">
@Html.LabelFor(m => m.Key)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.Value)
@Html.ValidationMessageFor(m => item.Value)
</div>
In your view use:
<fieldset>
@Html.EditorFor(m > m)
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
You need to do this because the foreach
doesn't create the correct name for the elements.