I am creating a helper with ASP NET MVC 3 and Razor to display my grid
@helper ListaPessoa(IEnumerable<TesteHelpersMV3.Models.PessoaModel> listaPessoa)
{
<table>
<tr>
<th></th>
<th>Nome</th>
<th>Endereco</th>
<th>DataNascimento</th>
</tr>
@foreach (var item in listaPessoa)
{
<tr>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Nome }) |
@Html.ActionLink("Details", "Details", new { id = item.Nome }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Nome })
</td>
<td>@item.Nome</td>
<td>@item.Endereco</td>
<td>@item.Cidade</td>
</tr>
}
</table>
}
but the Razor can not find @Html.ActionLink and the following error occurs
Compiler Error Message: CS1061: 'System.Web.WebPages.Html.HtmlHelper' does not contain a definition for 'ActionLink' and no extension method 'ActionLink' accepting a first argument of type 'System.Web.WebPages.Html.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
what is wrong? ?? how to solve this problem??
Thank You
Leandro Prado
Add @using System.Web.Mvc.Html
.
This is added automatically in Views\Web.config, so it won't apply to any pages outside of the Views folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With