Hello everyone, I have a list of links on my Home View:

<ul class="nav navbar-nav"> @foreach (var item in ViewBag.RegList) { <li>@Html.ActionLink((string)item.registryName, "Index", "Registry", new { item.registryName }, new { item.registryID }) </li> } </ul> 

I don’t understand how to specify parameters for the controller in ActionLink and where will they go next?

Index I declared so:

 public async Task<ActionResult> Index(object attr) 

But in attr I get an object, which when caste in string becomes null. If the input type is also null.

How to pass a parameter? Or am I the wrong type of caste? I want to transfer an array.

It is also not clear that in the fourth parameter - routeValues?

Method description: https://msdn.microsoft.com/en-us/library/dd504972(v=vs.108).aspx https://msdn.microsoft.com/en-us/library/dd493068(v=vs .108) .aspx

    1 answer 1

    You must add all parameters passed to routedValues

     <li>@Html.ActionLink((string)item.registryName, "Index", "Registry", new { name = item.registryName, id = item.registryID }) </li> 
    • Yeah, I already figured out, but thanks anyway! - Ivan Maslov