模型列表计数始终为0

时间:2019-10-02 09:36:49

标签: .net razor core

我正在处理asp.net核心剃须刀页面,而不是MVC。

我的模型中有一个列表,正在绑定它。

[BindProperty]
public List<CustomerAccount> CustomerAccounts { get; set; }

在html端 我有页面模型

@page
@model GF_GOInterface.Pages.CustomerAccountModel
@{
   ViewData["Title"] = "Customer Accounts";
 }

 I use a for loop to access the values of the list

@for (int i = 0; i <Model.CustomerAccounts.Count(); i++)
{
<div class="row">   
<div class="col-md-1 col-data"> @Model.CustomerAccounts[i].Account</div>

</div>

}

但过帐后,CustomerAccounts列表为空。 它不为null,但计数始终为0。

我是剃刀的新手,真的很卡在这里。 请让我知道可能出了什么问题。

0 个答案:

没有答案
相关问题