나는이 코드에서 i를 증분하여 구문 분석 할 수 없습니다. 아래 코드에서 나는 무엇이 잘못 되었습니까? 그런 다음asp.net mvc 면도기는 카운터 증분을 전달할 수 없습니다.
@{ var QuotationDetailList = Model.QuotationDetailList;}
foreach
대신 여기에 for
을 사용합니다 :
@{
int i=0;
}
@foreach (var item in Model.PortServiceTariffIncluded)
{
<tr id="@("sp" + item.ServiceId)">
<td>@item.ServiceName <input type="hidden" name="QuotationDetailList[i].ServiceId" value="@item.ServiceId" /></td>
<td>@item.ServiceCriteria</td>
<td>@item.ItemBasis</td>
<td>@Html.DropDownListFor(model => model.Currency, ViewBag.CurrencyDd as SelectList) <input type ="text" id="[email protected]" name="QuotationDetailList[i].Amount" /></td>
<td><input type="hidden" value="@item.ServiceId" class="serviceslist" name="serviceslist" /><input type ="button" id="@item.ServiceId" name="btnremove" value="Remove" class="clsremove" /></td>
</tr>
i = i + 1;
}