MVCContrib InputForm出现问题和 SparkViewEngine
我正在尝试使用 MVCContrib InputBuilders 但遇到麻烦。我还使用 S#arp 架构和 Spark。我的 Spark 视图如下所示:
new.spark:
<viewdata model="NewUserViewModel" />
${Html.InputForm<NewUserViewModel>()}
我的 global.asax.cs 包含:
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 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);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当我回答自己的问题时,我讨厌它,但我发现将其添加到
下的 /Views/Web.config 解决了我的问题。
我不太确定为什么这有帮助。我的猜测是我的应用程序被配置为仅使用 Spark 视图,这将添加常规视图引擎,但我不是这里的专家。
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.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.