views:

213

answers:

1

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, views, partials, etc.) are compiled into a single class.

If I try to setup a view involving more than one template, I get the following exception:

Only one viewdata model can be declared. PropertyViewModel<DateTime> != PropertyViewModel<object>

If leave just one viewdata declaration, I get another exception about the passed model item mismatching the required one.

It seems like I will have to give up either the Input Builders or Spark, which is sad because I really love both. So I thought I'd ask here to see if anybody has already figured this out.

Thanks.

A: 

You can always use <% Html.RenderPartial() %> for partial view rendering with different model. This will create more than one view class.

LukLed
The problem is that I'm not calling the partials directly; they are called by the InputBuilder assembly so I don't think I have control over that.
Daniel Liuzzi
Could you give example of your code?
LukLed