Domanda

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?

È stato utile?

Soluzione

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.

Altri suggerimenti

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") 
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top