开发者

MVC Contrib Input Builders and Spark View Engine

开发者 https://www.devze.com 2022-12-12 04:06 出处:网络
In Eric Hexter\'s Input Builders, different templates use different strongly-typed models; for example String uses PropertyViewModel<object>, DateTime uses PropertyViewModel<DateTime>, For

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 tha开发者_StackOverflow中文版t 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消