Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 正在使用模型名预填充HTML.TextBoxFor_C#_Asp.net Mvc_Razor - Fatal编程技术网

C# 正在使用模型名预填充HTML.TextBoxFor

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

我有一个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=""})

    }
}
@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字符串时