For some reason my action link behavior sends users to a strange place.
I have two classes: locations and properties.
From the locations view I want a link that leads the users to browse properties in that location:
@Html.ActionLink( "Browse", "Browse", "Property", new { id=item.ID } )
So I would like the HTML link and the method to have the same name: “browse”.
Instead of having it in the current controller/view I want to send the ID to the properties controller. Notice the word “Location” does not appear in the line above.
But the URL ends up:
I want it to end up like this:
The API in MVC 3 appears to be:
ActionLink( "text to display as HTML link", "action name", "controller", "parameters" )
Which seems to be how I did it, but I get unexpected results.
What am I doing wrong?
There is no method signiture
ActionLink(HtmlHelper, String, String, String, Object).It is using the
ActionLink(HtmlHelper, String, String, Object, Object)which has the following parameter names:Use this method instead:
which has the following parameter names:
See the full list of overloads