Trouble with MVCContrib InputForm<T> and SparkViewEngine
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);
}
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.
精彩评论