簡體   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