6

I'm sure I have seen this syntax

<%= Url.Action((MyController c) => c.MyMethod("a")) %>

or something like it as a way to generate action URLs in ASP.net MVCs without magic strings. However, I can't find that Action overload. I have ASP.NET MVC 1.0. Where is it?

ljubomir
  • 1,495
  • 1
  • 21
  • 40
erikkallen
  • 33,800
  • 13
  • 85
  • 120

1 Answers1

8

You need ASP.NET MVC v1.0 Futures assembly:

<%= Html.ActionLink<MyController>(x => x.MyMethod(a), "text") %>

<%= Html.BuildUrlFromExpression<MyController>(x => x.MyMethod(a)) %>
eu-ge-ne
  • 28,023
  • 6
  • 71
  • 62