zaria khan
zaria khan

Reputation: 333

How to Pass Parameters to Action Method

I have a controller DPN and within that controller, I have an Action Method

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

I want to know how can I pass a parameter to Report using Url.Action I tried this but got an error

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

Upvotes: 0

Views: 1768

Answers (2)

Vivek Nuna
Vivek Nuna

Reputation: 1

Url.Action("Report", "ControllerName", new { reportName = "AffiliateTFNDailySummary"});

Upvotes: 1

Jakub Rusilko
Jakub Rusilko

Reputation: 877

Try this:

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

Upvotes: 1

Related Questions