My goal is pretty simple I want to create strongly typed ActionLink helper for concrete controller in ASP.NET MVC. But it just doesn't work; I thought I'm on right way... Can you give me any advice?

public static MvcHtmlString ActionLinkFor<TController>(this HtmlHelper<TModel> html, Expression<Func<TController, ActionResult>> action)
    return MvcHtmlString.Empty;

Usage is pretty simple (<li>@(Html.ActionLinkFor<HelloController>(a => a.Index))</li>), but I'm ending with error message:

CS0428: Cannot convert method group 'Index' to non-delegate type 'System.Web.Mvc.ActionResult'. Did you intend to invoke the method?

Related posts

Recent Viewed