Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html Helper Extensions not being found

I'm using the release version of ASP.net MVC and I seem to be getting this error a lot

'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no extension method 'RenderPartial' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)

which is very odd since I can browse to System.Web.Mvc.HtmlHelper and all the extension methods are there. Even stranger is that I can compile and all the errors go away, however as soon as I start editing again they show back up. I am including

<%@ Import Namespace="System.Web.Mvc" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>

in my site.master file which I found suggested somewhere but that doesn't seem to help. Any ideas? The intelisense isn't finding the extension methods either.

like image 884
stimms Avatar asked May 18 '09 05:05

stimms


1 Answers

First, check if you are using RenderPartial method right:

<% Html.RenderPartial(...); %>

Second, check your web.config contains:

<system.web>
    <compilation>
        <assemblies>
            <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </assemblies>
    </compilation>
    <pages>
        <namespaces>
            <add namespace="System.Web.Mvc.Html" />
        </namespaces>
    </pages>
</system.web>
like image 182
eu-ge-ne Avatar answered Nov 15 '22 09:11

eu-ge-ne