Formatting text in Html. ActionLink

I have this menu:

   <ul class="menu">
        <li><a href="/"><span class="activ">пункт1</span></a></li>
        <li><a href="/"><span>пункт2</span></a></li>
   </ul>

You must use @Html.ActionLink, I can write

 <ul class="menu">
        <li><a href="/"><span class="@ViewBag.ClassActive">пункт1</span></a></li>
        <li>@Html.ActionLink("Пункт1", ....)</li>
   </ul>

How do I wrap the string "Item 1" in item 1?

And then output as plain text. I wanted to use Html.Raw and new HtmlString, but the type doesn't fit

Type conversion from " System.Web.IHtmlString "to" string " is not possible

Author: Колямбий, 2014-07-30

1 answers

In addition to @Html.ActionLink, which generates markup of the <a href="/....">пункт2</a> type, has the @Url.Action method, which generates only a link. That is, your task can be solved like this:

<li><a href="@Url.Action("Пункт1", ....)"><span>пункт2</span></a></li>
 1
Author: Pleshkov Ivan, 2014-08-07 11:18:03