Reputation: 91
I'm having a hard time on a thing that in the end, must be simple. Using a @Html.ActionLink , all I want is a link with the text of the name from the Model on a table.
Here's what I'm doing:
<td data-th="Nome">@Html.ActionLink( @item.Name , "Details", new { id = @item.UserID })</td>
But I get the error:
HtmlHelper has not applicable method named 'ActionLink' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax
Upvotes: 1
Views: 2261
Reputation: 651
This problem happens when you try to pass dynamic varibles inside extensions methods. This is not supported.
Problably you have one of these situations:
Name
property is a dynamic varible. You can try casting it to string
: (string) @item.Name
@model MyModel
.Upvotes: 1
Reputation: 3717
For MVC 3+ version
@Html.ActionLink( @item.Name , "Action_Name", "Controller_Name" , new { id = @item.UserID }, null)
@Html.ActionLink( @item.Name , "Action_Name", "Controller_Name" , new { @item.UserID }, null)
ID is no longer require in mvc 3+ versions
Upvotes: 0