[英]html code in anchor tag text in c# razor
I am trying to show the rupee sign: ₹ code: ₹ ; 我正在尝试显示卢比符号:₹代码:₹ in my anchor tag. 在我的锚标签中。
I have tried a few things but nothing works ... please help 我已经尝试了一些方法,但是没有任何效果...请帮助
@{ 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)
I'm not sure you can do it with Html.ActionLink
, but you can always construct it manually by using <a href='@Url.Action("Index")'>@Html.Raw("₹")</a>
. 我不确定您可以使用Html.ActionLink
来做到这一点,但始终可以使用<a href='@Url.Action("Index")'>@Html.Raw("₹")</a>
来手动构造它<a href='@Url.Action("Index")'>@Html.Raw("₹")</a>
。
@{ string _text =
String.Format("{0} {1} {2} {3} {4}",
@Html.DisplayFor(model => model.NoOfBedrooms),
"bedroom flat",
@Html.DisplayFor(model => model.TransactionTypeDescription),
"₹",
@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.