views:

52

answers:

1

I am trying to use MVCContrib InputBuilders but I am having trouble. I am also using S#arp architecture and spark. My spark view looks like this:

new.spark:

<viewdata model="NewUserViewModel" />
${Html.InputForm<NewUserViewModel>()}

My global.asax.cs contains:

  protected void Application_Start() {
    XmlConfigurator.Configure();
    var controller = InitializeServiceLocator();
    ModelBinders.Binders.DefaultBinder = new SharpModelBinder();            
    ViewEngines.Engines.Clear();
    InputBuilder.BootStrap();
    ViewEngines.Engines.Add(controller.Resolve<IViewEngine>());
    RouteRegistrar.RegisterRoutesTo(RouteTable.Routes);
  }
A: 

I hate it when I answer my own question but I found adding this to the /Views/Web.config under </system.web> fixed my problem.

    <pages
    validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <controls>
            <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
        </controls>
    </pages>

I'm not really sure why that helped. My guess is my app was configured to only to work with spark views and this is adding the regular view engine back in, but I am not expert here.

Chris Nicola
Though this didn't really help much because now the form is just inserted outside and at the top of the page and not rendered within the content block it should be inside.
Chris Nicola