如何在此Html.ActionLink中插入HTML字符? [英] How to insert a HTML character into this Html.ActionLink?

查看:62
本文介绍了如何在此Html.ActionLink中插入HTML字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码来生成此代码:

I'm using the following code to generate this:

<p>@Html.ActionLink("Read", "Index", "News", null, new { @class = "btn btn-default" })</p>

但是我想制作一个看起来像这样的按钮(使用HTML字符& raquo; ):

But I want to make a button that looks like this (with the use of HTML character &raquo;):

但是,当我执行以下操作时:

However when I do the following:

<p>@Html.ActionLink("Read &raquo;", "Index", "News", null, new { @class = "btn btn-default" })</p>

我明白了:

我该如何解决?

推荐答案

此处提供的其他解决方案也可以使用.但是,以防万一,如果键盘上没有特殊字符,该怎么办:

Other solutions given here work. But just in case you are wondering, what to do if you dont have the special character on keyboard, here it goes:

您可以使用

<a href='@Url.Action("Index", "News")' class="btn btn-default">Read &raquo;</a>

OR

@Html.ActionLink(HttpUtility.HtmlDecode("Read &raquo;"), "Index", "News", null, new { @class = "btn btn-default" })

这篇关于如何在此Html.ActionLink中插入HTML字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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