gpt4 book ai didi

c# - @Url.Action C# 不工作两个参数

转载 作者:行者123 更新时间:2023-12-04 04:53:07 25 4
gpt4 key购买 nike

我正在调用下面的 JQuery,它运行良好,但是 porID 参数没有正确发送到 Controller 。 Net 而不是获取“porID”是“amp; porID”。 Chrome 网络看到了这一点......

查询

oTable = $('#lista_cbo').dataTable({            
"bServerSide": true,
"sAjaxSource": '@Url.Action("ListaGenerica", "Home", new { aController = "CBO", porID = true } )',
"bProcessing": true,
"oSearch": {"sSearch": "" + id + ""},
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mDataProp": "CBOID", "sTitle": "ID", "sWidth": "16px" },
{ "mDataProp": "Sigla", "sTitle": "Sigla", "sWidth": "64px" },
{ "mDataProp": "Tipo", "sTitle": "Tipo", "sWidth": "64px" },
{ "mDataProp": "Descricao", "sTitle": "Descrição" },
{ "mData": null, "bSortable": false, "fnRender": function (o) {return '<a class="icone_16x16_detalhe" href=/CBO/Detalhar/' + o.aData["CBOID"] + '>D</a>';}}
],
});

Controller C#
[HandleError]
[AcceptVerbs(HttpVerbs.Get)]
public JsonResult ListaGenerica(DataTables param, string aController, bool porID = false)
{
var iniciaRegistrosEm = param.iDisplayStart;
var totalRegistrosPorPagina = param.iDisplayLength;
var totalColunas = param.iColumns;

var result = ERP.Helpers.ListagemPadrao.ListaPadrao(
aController,
param.iDisplayStart,
param.iDisplayLength,
Request["mDataProp_" + param.iSortCol_0.ToString()],
param.sSortDir_0,
param.sSearch,
porID
);

return Json(new
{
sEcho = param.sEcho,
iDisplayStart = param.iDisplayStart,
iTotalRecords = result.TotalRegistros,
iTotalDisplayRecords = result.TotalRegistrosVisualizados,
aaData = result.Dados
}, JsonRequestBehavior.AllowGet);

}

最佳答案

用@Html.Raw 包裹@Url.Action:

@Html.Raw(Url.Action("ListaGenerica", "Home", new { aController = "CBO", porID = true } ))

java 脚本可能正在弄乱“&”符号。

关于c# - @Url.Action C# 不工作两个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17126143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com