我有一个表单,在页面顶部有一个输入部分,在下半部分它显示了已添加对象的列表。我需要能够编辑和删除这些对象,但我不确定从哪里开始或如何做。
此代码显示对象列表。
@if (Model.ListOfRecipients != null)
{
for (int i = 0; i < Model.ListOfRecipients.Count; i++)
{
<div class='recipient-wrapper'>
<div class='decision_block'>
<table class='recipient'>
<tr>
<td class='recipient-title'>
@Html.HiddenFor(model=>model.ListOfRecipients[i].RecipientId)
<h3>
@Html.DisplayTextFor(model => model.ListOfRecipients[i].RecipientName)
@Html.HiddenFor(model => model.ListOfRecipients[i].RecipientName)
</h3>
<div class='delivery-type'>
Delivery Type: @Html.DisplayTextFor(model => model.ListOfRecipients[i].DeliveryType)
@Html.HiddenFor(model => model.ListOfRecipients[i].DeliveryType)
</div>
</td>
<td class='na express'>
@Html.CheckBoxFor(model => model.ListOfRecipients[i].ExpressIndicator)
@Html.HiddenFor(model => model.ListOfRecipients[i].ExpressIndicator)
</td>
<td class='quantity'>
<h3>
Qty @Html.DisplayTextFor(model => model.ListOfRecipients[i].Quantity)
@Html.HiddenFor(model => model.ListOfRecipients[i].Quantity)
</h3>
</td>
<td class='action'>
<input class='button edit_recipient' type='button' value='Edit' />
<input class='button delete_recipient' type='button' value='Delete' />
</td>
</tr>
</table>
<input class='button update_recipient' type='button' value='Update' />
<a class='cancel_update' href='#'>Cancel</a>
</div>
</div>
</div>
}
}