【问题标题】:How to Pass Parameters to Action Method [duplicate]如何将参数传递给动作方法[重复]
【发布时间】:2016-11-04 06:51:13
【问题描述】:

我有一个控制器 DPN,在该控制器中我有一个操作方法

[HttpGet]
public virtual ActionResult Report(string reportName)
{
   str_ReportPath = string.IsNullOrEmpty(str_ReportPath) ? "/BundleDealer/" + reportName : str_ReportPath;
   return View();
}

我想知道如何使用Url.Action 将参数传递给Report 我试过了,但是出错了

<a href="@Url.Action(MVC.DPN.Report(), "AffiliateTFNDailySummary")">Provider</a>

【问题讨论】:

    标签: c# asp.net-mvc actionmethod


    【解决方案1】:

    试试这个:

    <a href="@Url.Action("Report", "controller name", new { reportName = "AffiliateTFNDailySummary" })">Provider</a>
    

    【讨论】:

      【解决方案2】:
      Url.Action("Report", "ControllerName", new { reportName = "AffiliateTFNDailySummary"});
      

      【讨论】:

        猜你喜欢
        • 2018-01-31
        • 1970-01-01
        • 1970-01-01
        • 2013-07-01
        • 1970-01-01
        • 2018-03-02
        • 2017-08-22
        • 2011-04-30
        • 2023-03-31
        相关资源
        最近更新 更多