how to generate Html.ActionLink with icon

I wanted to add to SLaks answer.

Using <a href="@Url.Action(...)"> with what user2567619 wanted.

<a href="@Url.Action("Create", "Home")" class="btn btn-primary">
    <i class="icon-pencil icon-white"></i>
    <span>
        <strong>Create</strong>
    </span>            
</a>

I think it's worth mentioning that @Url.Action can take it's parameters like this:

@Url.Action(string actionName, string controllerName) 

Whereas @Html.ActionLink can take it's parameters like this:

@Html.ActionLink(string linkText, string actionName, string controllerName) 

It may be pretty obvious, but I thought it was worth noting.

Edit

As Peck_conyon noted, for both @Url.Action and @Html.ActionLink, these are just one of the ten different overload methods.
For documentation on UrlHelper.Action, look here.
For documentation on LinkEtensions.ActionLink, look here.


@Html.ActionLink("Edit","Edit","",new { @class= "btn btn-primary" })

Result enter image description here


Simple as this:

@Html.ActionLink("Title", "Action", null, new {@class="btn btn-info fa fa-pencil" })

Html.ActionLink() only supports plain-text links.

You should use <a href="@Url.Action(...)"> for more-complex links.