views:

38

answers:

1

Anyone got the areaDescriptorFilter working with the spark view engine in asp.net mvc 2?

I don't even have the option to add a filter on the service as shown in the following:

http://sparkviewengine.com/documentation/viewlocations#Extendingfilepatternswithdescriptorfilters

Thanks if you can help or at least try.

A: 

I'm using areas with Spark in a project of mine. All I had to do was add AreaRegistration classes for each area like:

public class AdminAreaRegistration : System.Web.Mvc.AreaRegistration
{
    public override string AreaName
    {
        get { return "Admin"; }
    }

    public override void RegisterArea( AreaRegistrationContext context )
    {
        context.MapRoute(
            "Admin_default",
            "Admin/{controller}/{action}/{id}",
            new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}

and then in the global.asax call:

AreaRegistration.RegisterAllAreas();

I have my area views located in a folder named "Admin" under the default "Views" folder, with appropriate controller folders under that:

\MvcProject
  \Views
    \Admin
      \Home
        \Index.spark
      \Users
        \Index.spark

from the page you linked:

the AreaDescriptorFilter is added by default

so you shouldn't need to worry about adding it yourself.

dave thieben