0

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?

2

2 Answers 2

3

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.

2

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") 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.