htmlasp.net-mvchtml.actionlink

Anchor tag contains font not displayed properly if converted in @Html.ActionLink


HTML Code: <a href="#" class="btn btn-primary next-step"><i class="far fa-arrow-alt-circle-right"></i> Next1</a>

Display in UI: enter image description here

CSHTML Code:

@Html.ActionLink("'far fa - arrow - alt - circle - right'></i> Next1", "ActionName", new { controller = "MyController", id = 1 },
                                       new { @class = "btn btn-primary next-step" })

But Display in UI is: enter image description here

On conversion from HTML to @Html.ActionLink should be same in appearance. Help please. Thanks in advance.


Solution

  • Try putting the @Html.ActionLink inside the <i> tag instead, something like this:

    <i class="far fa-arrow-alt-circle-right">
        @Html.ActionLink("Next1", "ActionName", new { controller = "MyController", id = 1 },
        new { @class = "btn btn-primary next-step" })
    </i>