spark-view-engine

Spark view engine - passing model to partial view

It would like to iterate through list and render partial view for each element: <for each="Element elem in elements"> <render partial="partialViewName"> </for> How should I pass elem to partial view? <render partial> doesn't have additional parameters. I can use html.RenderPartial, but I would like to use Spark syntax. Is it po...

How can I see the parameters in intellisense in a spark file?

Hi, I've got spark intellisense working but when I open the parameters () of the method I can not see what is supposed to go in there and several of the methods have overloads so I can't see what options I have. For example !{Html.Hidden()} once I open the () I can not see what parameters I am to pass any ideas? ...

How can I dynamically create a compiled spark view?

I would like to do something like the following with spark. <viewdata model="IList[[string]]" /> <for each="var file in Model"> <use import="${file}" /> </for> This however, does not work because Spark is not evaluating the ${file} before it tries the import. This makes sense and I suspected it would not work, but how else could I do...

Spark T4 templates for ASP.NET MVC

I was just curious if any Spark T4 templates already exist that match/are similar to the out of the box web forms view templates (create, edit, details, etc...). My Google skills didn't lead me to any results. ...

Spark view engine automatically applies H() tu ${ ... }

This is part of my spark partial view (it is called TaskSearch): ${ Html.DropDownList("Search.Status", Model.Statuses, "All") } it is generated by non-spark view with code: <% Html.RenderPartial(ControllerActions.TaskSearch, ViewData["TaskSearchModel"]); %> Spark generates view class that contains Output.Write(H( Html.DropDownList...

spark view engine Precompilation and extension methods

In our web project we have added Extension methods in a folder \Code\Extensions\DateTimeExtension.cs containing an extension method called FromUtcToUserTimeZone() We use the spark view engine in asp.net mvc and want it to work on medium trust there for we need to make a pre compilation of the views. When the post build event runs I...

Getting at ViewData.Model from spark template post

I am trying to convert my spark views to use ViewData.Model instead of the namevaluecollection so that I can use AutoMapper to map my dto's to entities before it gets into my action method. I can access the viewdata.model from the view, but upon posting back the data, viewdata.model is null. here is some sample code: in my view: <view...

Spark View Engine "An assembly with the same simple name" error

I am trying out the Spark view engine with ASP MVC but get the error below when displaying a view. The view references model objects that are in a different assembly to the main web application (MyApp.Model.dll). I am stuck on the cause or resolution to this. Dynamic view compilation failed. 0,0): error CS1704: An assembly with the sam...

Spark and ASP.NET

I started playing with Spark in an ASP.NET MVC project. However I have an existing ASP.NET project that I can't port over to ASP.NET MVC, and was wondering if there is a way to use Spark with ASP.NET? ...

What are the benefits of using an alternate view engine?

I am playing with ASP.NET MVC and I see that there are a few alternate view engines available for it such as NHaml and Spark. My question is why would you use an alternate view engine? I don't see a benefit to having something like this: <ul if="products.Any()"> <li each="var p in products">${p.Name}</li> </ul> <else> <p>No pr...

ASP.NET MVC Email

Is their a solution to generate an email template using an ASP.NET MVC View without having to jump through hoops. Let me elaborate jumping through hoops. var fakeContext = new HttpContext(HttpContext.Current.Request, fakeResponse); var oldContext = HttpContext.Current; HttpContext.Current = fakeContext;...

Is is Possible to Use a Master Layout when using Spark in the form of the Direct Usage Example

Is is possible to use a master layout when using Spark in the form of the Direct Usage Sample? I have tried using both in my layout with my master layout in the same folder as the calling layout and I have also tried adding the master layout as a template to the SparkViewDescriptor in the code below? public class DefaultMessag...

Cannot use fluent html lambda expressions in Spark view

I'm attempting to use fluent html and the spark view engine in my asp.net mvc application. I've assinged the proper base class, added the assemblies, and when i do this.TextBox("MyProperty") it works fine. However I get the below exception when i attempt to use this.TextBox(m=>m.MyProperty). Any idea what can be causing this? Exception...

How can I make Input Builders (MVC Contrib) work with Spark View Engine?

Today I spent a good three hours trying to convert the project MvcContrib.Samples.InputBuilders, included in MVC Contrib to make it work with Spark View Engine, but so far was unable to do so. Does anybody have a clue why these two just won't get along? Changes I've made InputForm.spark: <viewdata model="SampleInput" /> !{Html.InputF...

MVC Contrib Input Builders and Spark View Engine

In Eric Hexter's Input Builders, different templates use different strongly-typed models; for example String uses PropertyViewModel<object>, DateTime uses PropertyViewModel<DateTime>, Form uses PropertyViewModel[], and so forth. Spark View Engine doesn't seem to allow this, because all elements that compose the presentation (masters, vie...

In ASP.NET MVC with Spark View Engine on form submisison error why am I getting a 404 resource not found?

My view: /User/EditUserName/2/me <viewdata model="EditUserNameViewData" /> <form action="~/User/EditUserName" method="post" class="span-15 last"> !{Html.TextBox("newUserName")} <Submit id='"chooseNewName"' value='"Choose new name"' /> </form> Controller actions: [AcceptVerbs(HttpVerbs.Get)] public ActionResult EditUserName(int id)...

Handling empty collections in view model with spark

In spark when sending a view model to the view when a collection is empty is causing me some headaches like so: <input value="model.addresses[0].street" /> Where "model.addresses" may be empty and thus gives an NRE. Is there anyway to handle this other than populating the collections prior to rendering. This is a bit of a pain as it ...

Using asp.net mvc 2 features with the spark view engine

I am working with an ASP.NET MVC project which was originally started from the CodeBetter.Canvas project - and I'm trying to move to ASP.NET MVC 2. I successfully upgraded my project using Eilon's upgrade tool, moved to VS2010 (although not yet to .NET 4). The issue I'm having currently is only occurring when using the spark view engine...

Spark View Engine - Master pages are not found/loaded from Views->Shared folder

I am adding spark to an existing ASP.Net application. Everything works expect for the following: I am unable to load/access ANY master pages from the Views->Shared folder. Normal "shared" content in the Views->Shared folder is accessible and loads/works correctly. But ANY page that needs ANY master page (Application.spark or {some_ma...

Passing potential nulls to Macros in Spark view engine

I have the following macro: <macro name="InputField" id="string" value="string"> ... <input type="text" id="${id}" name="${id}" value="${value} /> ... </macro> And the call to the macro: ${InputField( "model.address.address1", 75, "Address", model.Address.Address1 )} The only problem is that model.Address will be null in som...