To use this extension download and reference MVC 2 Futures .
public static string ActionFor<TController>(this UrlHelper helper, Expression<Action<TController>> action) where TController : Controller { return Microsoft.Web.Mvc.LinkBuilder.BuildUrlFromExpression(helper.RequestContext, helper.RouteCollection, action); }
To use this extension in a view use:
Url.ActionFor<MyControllerType>(controller=>controller.MyAction())
Recent Comments