How to use the Expression Parsing helpers

20 views
Skip to first unread message

George Mauer

unread,
Sep 1, 2011, 12:52:35 PM9/1/11
to mvccontrib-discuss
I want to build my own HtmlHelper with the following signature


public MvcHtmlString ButtonLink<CONTROLLER>(string
linkText, Expression<Func<CONTROLLER, ActionResult>> action, object
htmlAttributes = null) where CONTROLLER : IController


and usage

@Html.Mobile().ButtonLink<MyController>("My Text", x=>x.MyAction())

I am having trouble accounting for all the variations to get the
Action Name to pass to Url.Action(..)
I know that mvc contrib has helpers for getting action names out of
expressions but for the life of me I can't find them.

Can someone help?

Jeremy Skinner

unread,
Sep 6, 2011, 4:01:37 PM9/6/11
to mvccontri...@googlegroups.com
This isn't actually in mvccontrib, but microsoft's MvcFutures library
(Microsoft.Web.Mvc.dll). Check out the LinkBuilder class in that
assembly.

Jeremy Skinner
Sent from my iPhone

> --
> Contact Jeffrey Palermo or Eric Hexter with specific questions about the MvcContrib project. Or go to http://mvccontrib.org
>
> To unsubscribe from this group, send email to mvccontrib-disc...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/mvccontrib-discuss?hl=en

Reply all
Reply to author
Forward
0 new messages