Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionUrl in ASP.NET MVC Preview 5

I don't need a Link but rather only the href= part of the ActionLink.

But if I call Html.ActionLink(...) I get a back. Is there a way to just return the URL of the Action while not getting the ?

like image 613
Tigraine Avatar asked Sep 30 '08 07:09

Tigraine


2 Answers

MVC also provides a UrlHelper class which can do the same thing:

<%=Url.Action(actionName)%>
<%=Url.Action(actionName, htmlValues)%>
<%=Url.Action(actionName, controllerName, htmlValues)%>
like image 97
Dave Weaver Avatar answered Oct 27 '22 13:10

Dave Weaver


Edit: in response to commment, now including parameters:

<% =Html.BuildUrlFromExpression<YourController>(c => c.YourAction(parameter)) %>
like image 30
Casper Avatar answered Oct 27 '22 14:10

Casper