MVC3 - Razor: How to use html tag in ActionLink Name

I have a action link on my MVC3 razor view. Which have a action link as bellow:

@Html.ActionLink("Click Here (I do not have Middle Name)", 
                 "", "", new { @class = "button lines-6" })

I want to change action link text to:

<strong>Click Here </strong> (I do not have Middle Name)

Is there any way to sort it out.

Many Thanks


Using the URL.Action instead of an action link you have more control over the contents.

<a href="@Url.Action("Index", "Home")" class="button lines-6">
    <strong>Click Here </strong> (I do not have Middle Name)

A custom HtmlHelper extension is another option.

public static string ActionLinkSpan( this HtmlHelper helper, string linkText, string actionName, string controllerName, object htmlAttributes )
    TagBuilder spanBuilder = new TagBuilder( "span" );
    spanBuilder.InnerHtml = linkText;

    return BuildNestedAnchor( spanBuilder.ToString(), string.Format( "/{0}/{1}", controllerName, actionName ), htmlAttributes );

private static string BuildNestedAnchor( string innerHtml, string url, object htmlAttributes )
    TagBuilder anchorBuilder = new TagBuilder( "a" );
    anchorBuilder.Attributes.Add( "href", url );
    anchorBuilder.MergeAttributes( new ParameterDictionary( htmlAttributes ) );
    anchorBuilder.InnerHtml = innerHtml;

    return anchorBuilder.ToString();

You may also try a different flavor of above suggested option:

<li id="home_nav"><a href="<%= Url.Action("ActionName") %>"><span>Span text</span></a></li>

Need Your Help

add font verdana into phpword

php fonts phpword

I am working with phpword, they have some default fonts like arial, tims new roman. I want to use font verdana.

shell sort sequence implementation in C++

c++ algorithm sorting shellsort

I am reading about shell sort in Algorithms in C++ by Robert Sedwick.