I've been following tutorials for this, and I've been trying to make this work for the past hour and i don't see where my mistake is so here you go: I have a extention method in a project file:
namespace TomApps.Toolbox.MVC.Security
{
public static class HtmlExtention
{
public static MvcHtmlString GenerateSecureDataControls<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
{
...
}}
I put in my webconfig:
<system.web>
<customErrors defaultRedirect="/Home/Index"
mode="On">
<error statusCode="404" redirect="error" />
</customErrors>
<compilation debug="true" targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
**<add namespace="TomApps.Toolbox.MVC.Security"/>**
</namespaces>
<controls>
<add assembly="Ext.Net" namespace="Ext.Net" tagPrefix="ext" />
</controls>
</pages>
yet, if i don't put
@using TomApps.Toolbox.MVC.Security
in my view, i cannot use it:
@Html.GenerateSecureDataControls(model => model.RoleId)
At first i thought i I was because myname was conflicting, but i saw i made a mistake typing extension :) Any idea of what's wrong? Thanks