views:

44

answers:

2

Hello,

I am using the SparkViewEngine with ASP.NET MVC 1.0 and was wondering if there is a way to include another View within your current view.

For example, I have this view called ResourceManager.spark. Inside this file, I want to include another sub-view called Resources.spark.

Thanks! Abe

+1  A: 

Sure, you can use named content areas.

Take a look at the documentation on the Spark website

There is also a good video tutorial at DimeCasts.Net

AdamRalph
Hi Adam, I am actually looking to implement something more along the lines of a partial view. I do use content areas heavily on the project that I am working on and they work similar to the way master pages in ASP.NET works.However, thank you for your suggestions and I definitely appreciate the link to DimeCasts.net; there's a lot of great screencasts.
AbeP
+1  A: 

Yes you can using a partial file. The syntax is

<use file="Resources" />

it will then look for a file called Resources.spark in the View/<ControllerName> directory and if that isn't found in the shared directory.

If you name the file _Resources.spark then you could also use it as a custom element (sans the underscore) like so

<resources />

for more information see http://sparkviewengine.com/documentation/organizingcontent#Parsingandrenderingpartialfiles

olle
Thanks. This is exactly what I was looking for!
AbeP
It looks like DimeCasts.Net also posted a new tutorial on Partials (http://dimecasts.net/Casts/CastDetails/157).
AbeP