zaria khan zaria khan - 1 year ago 60
C# Question

How to Pass Parameters to Action Method

I have a controller

and within that controller I have an Action Method

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

I tried this but getting error

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

Answer Source

Try this:

<a href="@Url.Action("Report", "controller name", new { reportName = "AffiliateTFNDailySummary" })">Provider</a>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download