Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 通过asp路由传递多个参数_C#_Asp.net_Razor_Asp.net Core - Fatal编程技术网

C# 通过asp路由传递多个参数

C# 通过asp路由传递多个参数,c#,asp.net,razor,asp.net-core,C#,Asp.net,Razor,Asp.net Core,我的代码中有关于asp路由的问题。我的模型处理数据的get和set,然后我需要使用我的模型作为参数传递给我的控制器。下面是我的代码: 控制器: public IActionResult getEmployeeLedger(spGetLedger ledger) { //Everything is here } public class Ledger { public List<spGetLedger> enumledger { get

我的代码中有关于asp路由的问题。我的模型处理数据的
get
set
,然后我需要使用我的模型作为参数传递给我的控制器。下面是我的代码:

控制器:

    public IActionResult getEmployeeLedger(spGetLedger ledger)
    {
        //Everything is here
    }
public class Ledger
{
    public List<spGetLedger> enumledger { get; set; }
    public spGetLedger ledger { get; set; }
}
型号:

    public IActionResult getEmployeeLedger(spGetLedger ledger)
    {
        //Everything is here
    }
public class Ledger
{
    public List<spGetLedger> enumledger { get; set; }
    public spGetLedger ledger { get; set; }
}
公共分类账
{
公共列表enumledger{get;set;}
公共spGetLedger分类账{get;set;}
}
查看:

    public IActionResult getEmployeeLedger(spGetLedger ledger)
    {
        //Everything is here
    }
public class Ledger
{
    public List<spGetLedger> enumledger { get; set; }
    public spGetLedger ledger { get; set; }
}

@Html.DisplayFor(modelItem=>item.EducationalLoan)
是否使用当前代码/模型?否。路线参数仅用于路线和查询参数。如果要将查询参数绑定到模型,需要在模型上使用
[bind(“Property1”、“Property2”、“Property3”)]
,其中
PropertyX
是属性的名称(因此也必须是查询参数的名称),这意味着您的路线设置必须是asp路线属性X,对不起,我现在还是asp的新手。你能给我一个示例代码吗?我真的不明白你说的关于[Bind(“某物”)]@AlvinQuezon你必须这么做吗?你就不能用begin.form()吗?