首页 > 解决方案 > HTML.TextBoxFor 正在预填充模型名称

问题描述

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

我试过添加一个空属性和空“”,但这只会引发错误。我怎样才能让它加载并清空文本框。

@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=""})

    }
}

标签: c#asp.net-mvcrazor

解决方案


推荐阅读