I’m trying to figure out a trivial creation of a hyperlink (either through using an Html.ActionLink or plain hyperlink markup) to call a certain controller action and pass in a userId
In have a controller with an Index action. I have a hyperlink in another unrelated view where I need to all that controller’s index action and pass in a userId which is param in the action method.
Update:
Html.ActionLink("Test Something", "Index", "Tests", new { @userId = @Model.User.UserId }, null)
that is an example of what I tried. Problem is, it’s not showing Tests/ in the url when I moue over the url during runtime
You could use the ActionLink helper from any view anywhere in the application:
Assuming default routes this should generate: