asp.net mvc - Create custom Helper in ASP NET MVC 3 and Razor -


i creating helper asp net mvc 3 , razor display 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 razor can not find @html.actionlink , following error occurs

compiler error message: cs1061: 'system.web.webpages.html.htmlhelper' not contain definition 'actionlink' , no extension method 'actionlink' accepting first argument of type 'system.web.webpages.html.htmlhelper' found (are missing using directive or assembly reference?)

what wrong? ?? how solve problem??

thank you

leandro prado

add @using system.web.mvc.html.

this added automatically in views\web.config, won't apply pages outside of views folder.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -