Will the Spark view engine interoperate with webforms master pages?

后端 未结 5 746
孤城傲影
孤城傲影 2021-01-23 22:31

I really like Spark, but we\'ve already got a big investment in webforms based views. I\'d like to start using Spark without having to convert all my existing views up front.

5条回答
  •  星月不相逢
    2021-01-23 23:05

    Any luck on this?

    I have been able to host a spark view in a System.Web.Mvc.ViewUserControl call Html.RenderView() from the spark view. I bet I could also host a Spark view within a System.Web.Mvc.ViewUserControl using Html.RenderView() as well. This introduces some options (all with overhead) of sharing the master page:

    1. Write a simple wrapper .ascx for you .spark views. They'd had the same model object, the wrapper could call HtmlRenderPartial on the wrapped view.

    2. (vice versa) Write a simple wrapper .spark for your .ascx controls.

    When I tried have a view Index.spark use masterpage Site.Master, I received error message:

    The view 'Index' or its master could not be found. The following locations were searched:
    ~/Views/LfgSettings/Index.aspx
    ~/Views/LfgSettings/Index.ascx
    ~/Views/Shared/Index.aspx
    ~/Views/Shared/Index.ascx
    Layouts\Site.spark
    Shared\Site.spark 
    

    I don't know what these paths represent though, it looks like the search path for the Index view and the search paths for its masterpage. It seems though the .spark file cannot use a .master masterpage.

    I wonder though if its possible to write a wrapper .master file that calls into a .spark file which has the correct content regions. Some Reflector'ing would probably dig up some interfaces that could be made to work together.

提交回复
热议问题