c# - Is possible to create strongly typed action link helper? -
c# - Is possible to create strongly typed action link helper? -
my goal pretty simple want create typed actionlink helper concrete controller in asp.net mvc. doesn't work; thought i'm on right way... can give me advice?
public static mvchtmlstring actionlinkfor<tcontroller>(this htmlhelper<tmodel> html, expression<func<tcontroller, actionresult>> action) { homecoming mvchtmlstring.empty; } usage pretty simple (<li>@(html.actionlinkfor<hellocontroller>(a => a.index))</li>), i'm ending error message:
cs0428: cannot convert method grouping 'index' non-delegate type 'system.web.mvc.actionresult'. did intend invoke method?
instead of
<li>@(html.actionlinkfor<hellocontroller>(a => a.index))</li> use
<li>@(html.actionlinkfor<hellocontroller>(a => a.index()))</li> c# asp.net asp.net-mvc asp.net-mvc-4 lambda
Comments
Post a Comment