I need to create an html action link that is equalivent to
<a href="#">Test Link</a>
or an action link to the current page. Anyone have any examples?
A URL action is a hyperlink that points to a web page, file, or other web-based resource outside of Tableau. You can use URL actions to create an email or link to additional information about your data. To customize links based on your data, you can automatically enter field values as parameters in URLs.
There is a difference. Html. ActionLink generates an <a href=".."></a> tag whereas Url. Action returns only an url.
Use @Html. ActionLink("Menus", "Menu", "yourController", null, new { @class = "page-scroll" }) and add a controller method named Menu that return the view.
You can try with this:
<a href="@Url.Action(null)">Test Link</a>
The helper Url.Action
with the first parameter in null
, return the current action.
Update for @MichaelLeanos's comment
For MVC6:
<a href="@Url.Action()">Test Link</a>
Yes, I have a suggestion. Just put <a href="#">Test Link</a>
in your view. The only reason to use Html.ActionLink
is to resolve a URL dynamically. Here there's no need, so just use the HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With