繁体   English   中英

C#razor中的锚标记文本中的html代码

[英]html code in anchor tag text in c# razor

我正在尝试显示卢比符号:₹代码:₹ 在我的锚标签中。

我已经尝试了一些方法,但是没有任何效果...请帮助

        @{ string _text =
               String.Format("{0} {1} {2} {3} {4}",
               @Html.DisplayFor(model => model.NoOfBedrooms),
               "bedroom flat",
               @Html.DisplayFor(model => model.TransactionTypeDescription),
               @Html.Raw(₹),
               @Html.DisplayFor(model => model.Price));

           string _rental = "";
           if (Model.TransactionType == 2) { _rental = " per month"; } else { _rental = ""; };

           string _linkText = _text + _rental;
        }



@Html.ActionLink(_linkText, "Details", "Property", new { id = Model.PropertyId }, null)

我不确定您可以使用Html.ActionLink来做到这一点,但始终可以使用<a href='@Url.Action("Index")'>@Html.Raw("&#8377")</a>来手动构造它<a href='@Url.Action("Index")'>@Html.Raw("&#8377")</a>


@{ string _text =
           String.Format("{0} {1} {2} {3} {4}",
           @Html.DisplayFor(model => model.NoOfBedrooms),
           "bedroom flat",
           @Html.DisplayFor(model => model.TransactionTypeDescription),
           "&#8377;",
           @Html.DisplayFor(model => model.Price));

       string _rental = "";
       if (Model.TransactionType == 2) { _rental = " per month"; } else { _rental = ""; };

       string _linkText = _text + _rental;
    }

<a href='@Url.Action("Details", "Property", new { id = Model.PropertyId })'>
    @Html.Raw(_linkText)
</a>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM