[英]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("₹")</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.