mvc create my own html helper, how can i access httpcontext?
Posted
by rj
on Stack Overflow
See other posts from Stack Overflow
or by rj
Published on 2010-04-22T19:44:34Z
Indexed on
2010/04/22
19:53 UTC
Read the original article
Hit count: 231
asp.net-mvc
Hi,
I've come across two recommendations for creating custom html helpers: either extend an existing one, or write your own class.
I'd prefer to keep my custom code separated, it seems a bit sloppy to extend helpers for a decent-size application.
But the benefit I see in extending is that 'This HtmlHelper helper' is passed as a parameter, through which I can get ViewContext.HtmlContext.
My question is, how can I roll my own helper class and still have ViewContext.HtmlContext available to me?
Thanks!
© Stack Overflow or respective owner