asp.net mvc - @Url.Action or Html.Action missing directive or assembly in Razor -


im unable use html.action or @url.action in razor application missing directive or assembly @ top of page. want add link grid holds edit , delete buttons can me

var columns = new list<webgridcolumn>(); columns.add(new webgridcolumn{ columnname = "name", header = "name"});  var grid = new webgrid(db.query("select * d_heirachy"));        @grid.gethtml( tablestyle:"mystyle", headerstyle:"columnheader", alternatingrowstyle:"alternate-row", columns: columns);          

this webconfig

  <configuration> <configsections>   <!-- more information on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 -->   <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=5.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <system.web>   <compilation debug="true" targetframework="4.5">     <assemblies>               <add assembly="system.security, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" />       <add assembly="system.data.entity, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" />       <add assembly="system.data.entity.design, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" />     </assemblies>     <buildproviders>       <add extension=".edmx" type="system.data.entity.design.aspnet.entitydesignerbuildprovider" />     </buildproviders>   </compilation>   <httpruntime targetframework="4.5" /> </system.web> <connectionstrings>   <add name="startersite" connectionstring="data source=|datadirectory|\startersite.sdf" providername="system.data.sqlserverce.4.0" />   <add name="storeentities" connectionstring="metadata=res://*/app_code.model.csdl|res://*/app_code.model.ssdl|res://*/app_code.model.msl;provider=system.data.sqlserverce.4.0;provider connection string=&quot;data source=|datadirectory|\startersite.sdf&quot;" providername="system.data.entityclient" /> </connectionstrings> <system.data>   <dbproviderfactories>     <remove invariant="system.data.sqlserverce.4.0" />     <add name="microsoft sql server compact data provider 4.0" invariant="system.data.sqlserverce.4.0" description=".net framework data provider microsoft sql server compact" type="system.data.sqlserverce.sqlceproviderfactory, system.data.sqlserverce, version=4.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91" />   </dbproviderfactories> </system.data> <entityframework>   <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> </entityframework> 

sounds you're either missing web.config file in views directory, or you're missing system.web.webpages.razor section defines namespaces included (by default) within each view.

your views config should have above node defining namespaces node includes things system.web.mvc. example, ~/views/web.config has following section within <configuration>:

<system.web.webpages.razor>     <host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />     <pages pagebasetype="system.web.mvc.webviewpage">         <namespaces>             <add namespace="system.web.mvc" />             <add namespace="system.web.mvc.ajax" />             <add namespace="system.web.mvc.html" />             <add namespace="system.web.routing" />             <add namespace="system.web.optimization" />         </namespaces>     </pages> </system.web.webpages.razor> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -