ASP.net MVC Action URLs with lambda expression
Asked Answered
T

1

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?

Thaddeus answered 15/7, 2009 at 16:22 Comment(0)
T
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)) %>
Tega answered 15/7, 2009 at 16:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.