--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spark-dev?hl=en.
On Dec 7 2009, 8:12 pm, Louis DeJardin <louis.dejar...@gmail.com>
wrote:
> I'm kind of curious also - does <use model="YourModelClass"/> make a
> difference in that case?
>
> On Sun, Dec 6, 2009 at 4:42 PM, Artem Tikhomirov <ar...@tikhomirovs.ru>wrote:
>
> > You should create your personal base class for Spark views. Then you should
> > create it's generic derivative having new Html property returning strongly
> > typed HtmlHelper<T>.
>
> > On Fri, Nov 27, 2009 at 4:36 PM, Chris <cmdrk...@googlemail.com> wrote:
>
> >> Is there any way of getting an HtmlHelper<T> instance in a spark
> >> view? I'm trying to use some third part extensions that depend on
> >> it. I did find this post (
>
> >>http://groups.google.com/group/spark-dev/browse_thread/thread/618bd44...
> >> ) and so downloaded the latest build from the TeamCity install on
> >> codebetter.com but I still can;t seem to find the the strongly typed
> >> helper. Any ideas? If this hasn't actually been done I'm quite happy
> >> to fork on gh and give it a go myself.
>
> >> --
>
> >> You received this message because you are subscribed to the Google Groups
> >> "Spark View Engine Dev" group.
> >> To post to this group, send email to spar...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/spark-dev?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Spark View Engine Dev" group.
> > To post to this group, send email to spar...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > spark-dev+...@googlegroups.com<spark-dev%2Bunsu...@googlegroups.com>
public abstract class MySparkView
: SparkView
{
}
public abstract class MySparkView<TModel>
: SparkView<TModel>
where TModel : class
{
public new HtmlHelper<TModel> Html
{
get
{
HtmlHelper<TModel> result = base.Html as HtmlHelper<TModel>;
if (result == null && base.Html != null)
{
result = new HtmlHelper<TModel>(base.Html.ViewContext,
base.Html.ViewDataContainer);
base.Html = result;
}
return result;
}
}
}
Then using the SparkSettings object (I use code to build it up instead
of Web.config):
mySettings.SetPageBaseType(typeof(MySparkView))
I haven't fully tested the change (I'm in the middle of a project
rewrite when I discovered that my converted .aspx views couldn't use
typed helpers anymore), but that portion, at least, is passing view
compilation.
> > >> spark-dev+...@googlegroups.com<spark-dev%2Bunsubscribe@googlegroups .com>
> > >> .
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/spark-dev?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Spark View Engine Dev" group.
> > > To post to this group, send email to spar...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > spark-dev+...@googlegroups.com<spark-dev%2Bunsubscribe@googlegroups .com>