1
votes

I have an MVC app with two areas, one for each line of business (they share the root codebase). In the root HtmlHelper extensions class I have some generic HtmlHelpers applicable to both areas. Is it possible to have an Area specific HtmlHelper who's methods will show in intellisense only while coding in that specific area, be it via web.config of the area?

Shared HelpHelper extensions:

namespace System.Web.Mvc.Html{
public static class Helper{
public static MvcHtmlString CommonHelper(this HtmlHelper htmlHelper){ //some code here } } }

Area specific HtmlHelper extensions:

namespace System.Web.Mvc.Html{
public static class Helper{
public static MvcHtmlString ExampleHelper(this HtmlHelper htmlHelper){ //area specific functions } } }

Many thanks.

1

1 Answers

1
votes

You could define this HTML helper in the AppName.Areas.SomeAreaName.Extensions namespace:

namespace AppName.Areas.SomeAreaName.Extensions
{
    public static class Helper
    {
        ...
    }
}

and then use the namespaces section of the ~/Areas/SomeAreaName/Views/web.config file to register it.