开发者

How to generate just the URL of the Controller method in ASP.NET MVC

开发者 https://www.devze.com 2022-12-24 16:18 出处:网络
So Html.ActionLink(\"Report\", \"SendMail\", \"Misc\", new { id = Model.ImageID }, null) will generate a nicely formatted link.

So Html.ActionLink("Report", "SendMail", "Misc", new { id = Model.ImageID }, null) will generate a nicely formatted link.

<a href="http://localhost:3224/Misc/SendMail/5">Send Mail</a>

How can I generate just the开发者_StackOverflow中文版 URL of the link, short of parsing the output of Html.ActionLink?


Does this work for you

<%= Url.Content("~/Misc/SendMail/" + Model.ImageID) %>

Or try

<%= Url.Action( "SendMail", "Misc", new { id = Model.ImageID }) %>


<%= Url.Content("~"+Url.Action( "SendMail", "Misc", new { id = Model.ImageID })) %>

should work for you i think

0

精彩评论

暂无评论...
验证码 换一张
取 消