簡體   English   中英

ASP.NET CORE 3 frombody NULL 帶 Bootstrap Table 插件

[英]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; }
}

當你調用Get_InboxTableData時,你會有三個參數, UserType,offset and limit 。所以你可以嘗試使用

public class InboxTableData
    {
        public string UserType { get; set; }
        public int limit { get; set; }
        public int offset { get; set; }

    }

結果: 在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM