Search code examples
htmlasp.net-mvc-4html.actionlink

how can I add h3 on actionlink


My first ActionLink is ok. But how can I add h3 tags ?

<a href="/channel/index/44">@a.Title</a>
@Html.ActionLink(@a.Title, "Index", "Channel", new { @a.Id }, null)

How can i do actionlink this link?

<a href="/Channel/index/44"><h3>@a.Title</h3></a>
 ?

Solution

  • The only way you can get HTML markup in your link text is to use @Url.Action. For example your code will look like this:

    <a href="@Url.Action("Index", "Channel", new { Id = a.Id })"><h3>@a.Title</h3></a>