【发布时间】:2021-05-20 04:30:18
【问题描述】:
我正在尝试根据引导表中的此示例进行操作 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>
控制器
[HttpPost]
public string Get_InboxTableData([FromBody] InboxTableData inboxData)
{
return inboxData.UserType;
}
型号
public class InboxTableData
{
public string UserType { get; set; }
}
【问题讨论】:
-
表格或输入字段中的数据在哪里?
-
现在我不想显示数据。我只想将参数从视图传递给控制器。即使有数据,我的表格也能正确显示,除非传递 UserType 等自定义参数。
标签: asp.net asp.net-core asp.net-core-3.1 asp.net-core-3.0 bootstrap-table