I have a long title and need to add something like a line break within the ActionLink. I've tried \r\n as well as System.Environment.NewLine...all with no success.
<%=Html.ActionLink("Long title goes here", "index", "Overview")%>
ActionLink(HtmlHelper, String, String) Returns an anchor element (a element) for the specified link text and action. ActionLink(HtmlHelper, String, String, Object) Returns an anchor element (a element) for the specified link text, action, and route values.
Yes, there is a difference. Html. ActionLink generates an <a href=".."></a> tag whereas Url. Action returns only an url.
The Anchor Tag Helper generates HTML anchor (<a> </a>) element by adding a new attribute. The "href" attribute of the anchor tag is created by using new attributes. The Anchor Tag Helper generates an HTML anchor (<a> </a>) element by adding new attribute.
If you need to pass through the reference to an object that is stored on the server, then try setting a parameter of the link to give a reference to the object stored on the server, that can then be retrieved by the action (example, the Id of the menuItem in question).
You may try something like this:
<a href="<%= Url.Action("index", "overview") %>">
Long title first line<br/>
Long title second line<br/>
Long title third line
</a>
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