我有一个ASP MVC 3网站,我们想在操作链接中添加一些样式。
我希望HTML的代码是这样的<a href="/somepath/someaction"><span class="someclass">some text</span> some more text</a>
,但我不知道如何告诉Razor正确地呈现它的<span>
部分。
我到目前为止尝试过的:
@Html.ActionLink("<span class="someclass">some text</span> some more text", SomeAction, SomeController);
结果是一个链接,看起来像这样:<span class="someclass">一些文本</span>更多的文本
@Html.ActionLink("<text><span class="someclass">some text</span></text> some more text", SomeAction, SomeController);
结果是一个看起来像这样的链接:<text><span class="someclass">一些文本</span></text>更多的文本
@Html.ActionLink(<text>"<span class="someclass">some text</span> some more text"</text>, SomeAction, SomeController);
导致编译错误。
你有什么想法吗?