Chandrabhan Rajbhar
Chandrabhan Rajbhar

Reputation: 21

How to add Font Awesome icon (fa fa icon) in @Html.ActionLink()

@Html.ActionLink("Create New", "Create", null, new { @class = "btn btn- warning fa fa-neuter" })

Upvotes: 1

Views: 6311

Answers (4)

user23560898
user23560898

Reputation: 1

<a href="@Url.Action("action name", "controller name", new { /*id=item.PrimaryKey */})" class="btn btn-danger btn-sm">
    <i class="fa-solid fa-person"></i>
</a>

Upvotes: -1

Rashmi Ranjan
Rashmi Ranjan

Reputation: 1

Although I am using this syntax in a List view. You can modify it. Use something like this.

@Html.ActionLink("", "Edit", new { /*id=item.PrimaryKey */ }, new{@class="btn btn-outline-primary btn-def fa fa-pencil"})

pardon me, I haven't used the primary key field here but I will add it later.

Upvotes: 0

AHMED Hussin
AHMED Hussin

Reputation: 3

@Html.ActionLink(" ", "Accept_suggested_company", new { id = item.id }, new { @class = "btn btn-outline-primary btn-def fa fa-save" })

You should only include it inside the class

Upvotes: 0

Gagan Deep
Gagan Deep

Reputation: 1509

Html.ActionLink() doesn't support complex links and have only plain text support.

You should use.

<a href="@Url.Action(...)"><i class="icon-pencil icon-white"></i> </a>

Upvotes: 2

Related Questions