我不需要链接,而只需要动作链接的href =部分。
但如果我打电话给Html.ActionLink(...)我会回来的。 有没有办法只返回Action的URL而没有得到?
答案 0 :(得分:10)
MVC还提供了一个UrlHelper类,它可以做同样的事情:
<%=Url.Action(actionName)%>
<%=Url.Action(actionName, htmlValues)%>
<%=Url.Action(actionName, controllerName, htmlValues)%>
答案 1 :(得分:2)
编辑:响应提交,现在包括参数:
<% =Html.BuildUrlFromExpression<YourController>(c => c.YourAction(parameter)) %>