ASP.net MVC 3 adding arbitrary text to the end of an ActionLink
- by infensus
Hi I have a question about Html.ActionLink.
Imagine:
@Html.ActionLink(item.title, "Singlet", new { id = item.blog_id })
produces http://[url]/[controller]/Singlet/[id]
But what if I want to suffix some more arbitrary data at the end? For example:
http://[url]/[controller]/Singlet/[id]/#comments
To jump to the comments div. I know I can just make the string myself with something like:
@( new HtmlString(String.Format("<a href=\"Blog/Singlet/{0}/#comments\">link to comments</a>", item.blog_id)) )
But I am hoping there is a cleaner way, perhaps with ActionLink?
Thanks