I am new to MVC, and trying to navigate via js to a controller action method. The code works (as in the action method is hit), but the parameter value I am passing in is always null
js:
window.location.href = "@Url.Action("Step1", "Reports")" + "/?" + rsid;
Controller action:
public class ReportsController : Controller {
public ActionResult Step1(int? rsid)
{
//do stuff
}
}
The rsid parameter is always null. I have tried various link formats, eg "/?rsid=[id]", "/[id]"
Do I need a custom route for the parameter to be picked up?
Or maybe annotate the action method with [httpPost] or [httpGet]?