Question

In the current controller Views/Users I have

grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.UserId }), style: "column-action"),

I have another view like Views/Comissions

So I want to add at the grid Html.ActionLink to up located controller

grid.Column(format: (item) => Html.ActionLink("Comission", "Index", "Comission", new { id = item.UserId }), style: "column-action")   

But I see wrong URL like

http://localhost:51381/Users?Length=16

instead of it should be like

http://localhost:51381/Comission/Index/123-sfsdf-2342342-ssdfsdf

Any clue how to fix it?

Was it helpful?

Solution

The problem is that the method you are creating the link is using the incorrect overload of the Html.ActionLink.

You will need to add null

Take a look at this other question to see the problem.

OTHER TIPS

You need to add null as last argument (which stands for htmlArguments) to use the correct Html.ActionLink overload:

grid.Column(format: (item) => Html.ActionLink("Comission", "Index", "Comission", new { id = item.UserId }, /*here ->*/null), style: "column-action") 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top