0

我想使用MVCContrib InputBuilders,但我遇到了麻煩。我也在使用S#arp架構和火花。我的觀點火花像這樣:MVCContrib InputForm問題<T>和SparkViewEngine

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); 
    } 

回答

0

我討厭它,當我回答自己的問題,但我發現增加這個給/Views/Web.config下的</system.web>修復了我的問題。

<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> 

我不太清楚爲什麼會有所幫助。我的猜測是我的應用程序被配置爲只處理spark的視圖,這是添加了常規的視圖引擎,但我不是這裏的專家。

+0

雖然這並沒有多大幫助,因爲現在表單只是插入到頁面的頂部,而不是在內容塊中呈現。 – 2009-12-31 01:35:18