内Html.ActionLink(),再加上没有链接文本把HTML? [英] Putting HTML inside Html.ActionLink(), plus No Link Text?

查看:200
本文介绍了内Html.ActionLink(),再加上没有链接文本把HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个问题:

  1. 我不知道我该如何使用时,没有显示链接文字 Html.ActionLink()在MVC视图(实际上,这是网​​站的.master )。
  1. 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?

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

  1. 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>

这篇关于内Html.ActionLink(),再加上没有链接文本把HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆