Will the Spark viewer interact with the main pages of web forms?

I really like Spark, but we already have a great investment in web form submissions. I would like to start using Spark without having to convert all my existing views forward.

The only problem that I encounter is that Spark works side by side with webforms - this is the master page. Currenly I have spark schemes that are 1 to 1 duplicate of the main pages.

This amount of duplication is not acceptable. I've been bitten several times.

Is there a way to get spark looks for working in masterforms? Or for submitting web forms to work in a spark layout? Or solve the problem of duplication.

+1
asp.net-mvc spark-view-engine
source share
5 answers

The way I did this was to transfer most of the contents of my main page into partial views, and then create two main pages: Foo.Master and Foo.Master.spark, which use the same Html.RenderPartial (). Both wizards have the same content area. This allows me to use any engine for this view and makes duplication as small as possible.

It is expected that the mechanism of a separate view will be handled by both its master and the view. Call IViewEngine:

FindView(System.Web.Mvc.ControllerContext controllerContext, string viewName, string masterName, bool useCache) 

It does not display the wizard separately from the view.

Spark uses this to compile the wizard into a view and other tricks with its multi-pass rendering.

+5
source share

I do not think so. Architecturally, the two have completely different and conflicting ways of displaying the page. For this to happen, you will need to do something that is equivalent to an iFrame, a horribly cloning way of making this happen in order to be an anti-template.

By the time the main page is read, the spark engine will be completed and vice versa.

You can try to reproduce how the main page is displayed in the spark engine. Not only visually ... I'm talking about combining the original homepage pre-processor with a spark. Hard move to the hoe.

+1
source share

Just try writing your own viewing engine (or tweaking Spark one) that displays the requested .spark view using the Spark engine and then calls the WebForms engine to pass the processed content to it - I think it should be possible, but I don’t know about these the insides. An easier way would be to save the .spark HTML render in .aspx and select WebForms - but the performance would not be acceptable.

In any case, I would say that this should be possible, but 1) it will require complex configuration of the viewing engines, and 2) you will lose most of the functionality of Spark / layouts, since your .spark views will basically display the same way, that's all.

Also try requesting the Spark mailing list.

0
source share

What a score?

I managed to start the spark view in a call to System.Web.Mvc.ViewUserControl Html.RenderView () from the spark view. I bet I could also place the Spark view in System.Web.Mvc.ViewUserControl using Html.RenderView (). This leads to some options (all with overhead) for sharing the main page:

  • Write a simple .ascx wrapper for you .spark views. They had the same model object, the wrapper could call HtmlRenderPartial in the wrapped state.

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

When I tried to have an Index.spark view using masterpage Site.Master, I received an 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 are, it looks like a search path for representing Index and search paths for its main page. It seems that the .spark file cannot use the .master main page.

Interesting, but if possible, write a wrapper .master file that calls the .spark file, which has the correct content areas. Some reflectors will probably dig up some interfaces that can be created to work together.

0
source share

You can use existing master pages with a very simple .aspx page that simply calls Html.RenderPartial ("MySparkView") so that you can fix the content inside existing existing pages.

0
source share

All Articles