ASP.Net MVC view unable to see HtmlHelper extension method
Posted
by larryq
on Stack Overflow
See other posts from Stack Overflow
or by larryq
Published on 2010-03-29T18:06:53Z
Indexed on
2010/03/29
18:13 UTC
Read the original article
Hit count: 563
Hi everyone,
We're going through an ASP.Net MVC book and are having trouble with using an extenstion method within our view. The Extension method looks like this:
using System;
using System.Runtime.CompilerServices;
using System.Web.Mvc;
namespace MvcBookApplication
{
public static class HtmlHelperExtensions
{
public static string JQueryGenerator(this HtmlHelper htmlHelper, string formName, object model);
}
}
We use the extension method in our view like this:
<%=Html.JQueryGenerator("createmessage", ViewData.Model)%>
The problem is, that line of code says JQueryGenerator isn't a recognized method of HtmlHelper. I believe we've got the correct references set in the web project, but are there other things we can check? There's no using statement for views, is there?
© Stack Overflow or respective owner