HtmlHelper does not contain definition for “Action”


HtmlHelper does not contain definition for “Action”



I use <%= Html.Action("ReadXML") %> and have this error:

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

How fix it

This is my assemblies:

   <assemblies>     <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />     <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />     <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />     <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />     <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />     <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />     <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />     <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />     <add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />    </assemblies> 

Maintain Constant Title Across Website

1:

Which is better for showing lots of small values in ASP.Net MVC - HTML helper or partial view
Action is an extension method contained in the System.Web.Mvc assembly. Strong Name Keys on Windows 7Make sure you have referenced the following namespaces in your web.config:. Accessing route values in view Mvc.net
<pages>   <namespaces>     <add namespace="System.Web.Mvc" />     <add namespace="System.Web.Mvc.Ajax" />     <add namespace="System.Web.Mvc.Html" />     <add namespace="System.Web.Routing" />   </namespaces> </pages> 
The method is declared in the System.Web.Mvc.Html namespace.. ASP.Net MVC 2.0 Client-Side Validation Posting Back Also make sure your project is ASP.NET MVC 2.0 as this method has been added in the 2.0 version.. Setting image markup to a div is not loading the image
ASP.Net MVC 2,0 EditorForModel QuestionChoosing CMS vs Portal vs MVC+Components?

2:

Make sure there is a reference to System.Web.Mvc in your project (add it if not already there).. Then make sure the class this is displaying this problem is importing the namespace - you must did this in a couple of ways:.
  • In the code behind add a using System.Web.Mvc; statement at the top.
  • You must also import the namespace directly in the aspx page if needed, by using this statement: <%@ import namespace="System.Web.Mvc"%>


85 out of 100 based on 70 user ratings 745 reviews

*