how to pass parameter from @Url.Action to controller function
asp.net-mvc, c#
Solution
you can pass it this way :
Url.Action("CreatePerson", "Person", new RouteValueDictionary(new { id = id }));
OR can also pass this way
Url.Action("CreatePerson", "Person", new { id = id });
Problem
I have a function `CreatePerson(int id)` , I want to pass `id` from `@Url.Action`. Below is the reference code: ``` public ActionResult CreatePerson(int id) //controller window.location.href = "@Url.Action("CreatePerson", "Person") + id"; ``` the above code fails to pass `id` value to `CreatePerson` function.