C# 正在使用模型名预填充HTML.TextBoxFor
我有一个HTML.TextBoxFor,它预先填充了System.Collections.Generic.List`1[System.String] 我尝试添加null属性和空“”,但这只是抛出了一个错误。如何让它加载并清空文本框C# 正在使用模型名预填充HTML.TextBoxFor,c#,asp.net-mvc,razor,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.PendingRegistration
@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=""})
}
}
@foreach(pendingReg.PaymentOptions.RegistrationPaymentTypes中的变量项)
{
@Html.RadioButtonNfy(m=>Model.PendingRegistrations.Cart[i].PaymentOptions.PaymentTypes,item.RegistrationTypePaymentTypeID,新{data\u val=item.PaymentTypeID})
@item.PaymentName
如果(item.PaymentTypeID==4)
{
@Html.TextBoxFor(model=>model.PendingRegistrations.Cart[i].PaymentOptions.PurchaseOrders,null,新{@class=“textboxClass”,@value=”“})
}
}
您的财产(PurchaseOrders
)是收藏类型吗?你期望一个集合如何用文本框呈现?谢谢你的回复,它帮助我解决了这个问题!我已经将采购订单创建为字符串列表。。。当它应该是一个公共int字符串时