内Html.ActionLink(),再加上没有链接文本把HTML?再加上、文本、链接、Html

2023-09-02 21:31:30 作者:你若安好哎哟我草

我有两个问题:

我不知道我该如何使用时,没有显示链接文字 Html.ActionLink()在MVC视图(实际上,这是网​​站的.master )。 I'm wondering how I can display no link text when using Html.ActionLink() in an MVC view (actually, this is Site.Master).

没有一个重载版本,不允许链接文本,当我尝试过在短短的空白字符串,编译器告诉我,它需要一个非空串。

There is not an overloaded version that does not allow link text, and when I try passing in just a blank string, the compiler tells me it needs a non-empty string.

我该如何解决这个问题?

How can I fix this?

我需要把<跨度>在锚标记中标签,但它不工作与 Html.ActionLink(); 。我想看到下面的输出:

I need to put <span> tags within the anchor tag, but it's not working with Html.ActionLink();. I'd like to see the following output:

跨度文本

我怎么可以把标签锚标记中的ASP.NET MVC?

How can I put tags inside of the anchor tag in ASP.NET MVC?

推荐答案

<a href="<%= Url.Action("Index", "Home") %>"><span>Text</span></a>
<a href="@Url.Action("Index", "Home")"><span>Text</span></a>

和做一个空白的网址,你可以有

And to do a blank url you could have

<a href="<%= Url.Action("Index", "Home") %>"></a>
<a href="@Url.Action("Index", "Home")"></a>