![](/img/trans.png)
[英]ASP.NET Core 3.1 HTTP post [FromBody] always receives null
[英]ASP.NET CORE 3 frombody NULL with Bootstrap Table plugins
我正在嘗試根據 bootstrap table query params中的此示例進行操作。 但是我收到的參數總是NULL,即使我在調用后端之前已經設置了它。 我希望收到的價值應該是Supplier 。 謝謝
看法
<table id="supplier-inbox-table" class="table table-bordered table-striped text-center bootstrap-table"
data-toggle="table"
data-query-params="InboxTableParams"
data-url="/AppService/Get_InboxTableData"
data-method="post"
data-pagination="true"
data-side-pagination="server">
<thead class="thead-dark">
<tr>
<th data-checkbox="true"></th>
<th data-field="ID" data-sortable="true">ID No</th>
<th data-field="Customer" data-sortable="true">Customer</th>
<th data-field="StoreCode" data-sortable="true">Store Code</th>
</tr>
</thead>
<script>
function InboxTableParams(params) {
params.UserType = 'Supplier';
return params;
}
</script>
controller
[HttpPost]
public string Get_InboxTableData([FromBody] InboxTableData inboxData)
{
return inboxData.UserType;
}
model
public class InboxTableData
{
public string UserType { get; set; }
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.