I have a FieldItems dictionary in ASP.NET model and this dictionary has values as below.
Age - checkbox, Name - text, Company - text
In my view file I was creating controls based on key, value pair which are available in the dictionary.
<div class="@Model.CssClass sf-fieldWrp">
<table>
<tr>
<td>
<table>
@foreach (var item in Model.FieldItems)
{
<tr>
@if (item.Value == "checkbox")
{
<td>@item.Key</td>
<td> <input id="associationCheckbox" type="@item.Value" name="@item.Key" placeholder="@item.Key" value="false"/></td>
}
else
{
<td>@item.Key</td>
<td> <input type="@item.Value" name="@item.Key" value="@Model.Value" placeholder="@item.Key" /> </td>
}
</tr>
}
</table>
</td>
<td>
<span>
<button type="button" class="btn btn-success" style="float:none;cursor:pointer" ng-click="RemoveWidget()">AddPerson</button>
</span>
</td>
</tr>
</table>
<span>
<button type="button" class="btn btn-danger" style="float:none;cursor:pointer" ng-click="AddWidget()">Remove</button>
</span>
</div>
Now my requirement for me is to include/remove the chosen fields based on button click. Rough design looks as below. Could you please provide few suggestions for this implementation?
Please check images in this order. 1. Initial 2. AfterAdd 3. AfterRemove
Intial
AfterAdd
AfterRemove
Images Link:
Thanks, Balu


