Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strongly typed actionlink with asp.net mvc beta?

I used to be able to do the following in Preview 3

<%=Html.BuildUrlFromExpression<AController>(c => c.AnAction(par1, par2)%>

How am I supposed to create urls in a strongly typed way with the MVC Beta? The only thing so far I have found is

<%= Html.ActionLink("aName", "ActionName", "ControllerName")%>

This is not strongly typed off course.

like image 695
Boris Callens Avatar asked Oct 20 '08 12:10

Boris Callens


2 Answers

You need the ASP.NET MVC Beta Futures, which is a separate download

ASP.NET MVC Beta Futures

then your original code will work as before.

See this post for getting it working: SO post on missing extensions

like image 80
Sam Mackrill Avatar answered Oct 05 '22 05:10

Sam Mackrill


The Microsoft.Web.Mvc assembly provides extension methods to the HtmlHelper which allow something like

<%= Html.ActionLink<SomeController>(c => c.Index()) %>
like image 35
hangy Avatar answered Oct 05 '22 04:10

hangy