I have an entity with a variable set of attributes named ExtendedProperty
, these have a key and a value.
In my html razor view, I have this:
@if (properties.Count > 0)
{
<fieldset>
<legend>Extended Properties</legend>
<table>
@foreach (var prop in properties)
{
<tr>
<td>
<label for="Property-@prop.Name">@prop.Name</label>
</td>
<td>
<input type="text" name="Property-@prop.Name"
value="@prop.Value"/>
</td>
</tr>
}
</table>
</fieldset>
}
How can I access this data on my controller once the user fills it in? Is there a way to do this so that I can use the model bindings instead of manual html?
EDIT = Please note that I'm still using a model, and there are other things in the form that do use things like @Html.EditFor(m => m.prop)
. But I couldn't find a way to integrate these variable properties in.
Thanks.