HTML.TextBoxFor预先填充了模型名称

时间:2018-06-15 21:26:42

标签: c# asp.net-mvc razor

我有一个HTML.TextBoxFor,它预先填充了System.Collections.Generic.List`1 [System.String]

我尝试添加一个null属性并清空“”但这只会引发错误。我怎么能加载和空文本框。

@foreach (var item in pendingReg.PaymentOptions.RegistrationPaymentTypes)
{
    @Html.RadioButtonFor(m => Model.PendingRegistrations.Cart[i].PaymentOptions.PaymentTypes, item.RegistrationTypePaymentTypeID, new { data_val = item.PaymentTypeID })
    <span>@item.PaymentName</span>
    <br />
    if (item.PaymentTypeID == 4)
    {
        @Html.TextBoxFor(model => Model.PendingRegistrations.Cart[i].PaymentOptions.PurchaseOrders, null, new { @class = "textboxClass", @value=""})

    }
}

0 个答案:

没有答案