Thomas
Thomas

Reputation: 15

Actionlink doesn't post the id

In my view I have the following actionlink:

Html.ActionLink(item.users.nickname, "Details", new { controller = "Account" }, new { id = item.users.id })

This should link to Acount/Details/2 but for some reason it only links to Account/Details I've even tried changing

 new { id = item.users.id }

into

new { id = 2 }

But that gives me the same outcome. I have the default MVC route in place but that shouldn't give any problem?

Upvotes: 0

Views: 319

Answers (2)

Saeed Neamati
Saeed Neamati

Reputation: 35822

@Html.ActionLink("Details", "Details", new { id = item.users.id }) should do it. Where do you determine the text of your link here?

Upvotes: 0

Kimpo
Kimpo

Reputation: 5836

Try this

Html.ActionLink(item.users.nickname, "Details", new { controller = "Account" , id = item.users.id })

Upvotes: 1

Related Questions