Is it possible to not encode the Label tag value rendered in ASP.NET Core HtmlHelper?

Viewed 29

I asked a similar question a while back: Is it possible to format Display attribute's Name property value of MVC Model class?

I am wondering would it be possible to not apply encoding in the ASP.NET Core HtmlHelper.Label tag?

What I have now is:

<label asp-for="CorporationName" class="control-label"></label>

I understand it will render the html .

Like so:

<label class="control-label" for="CorporationName">Corporation / <br/>Entreprise</label>

with the text value defined in this model class:

[DataType(DataType.Text)]
[Display(Name = "Corporation / <br/> Enterprise")]
public string Corporation { get; set; }

So I am wondering if it is possible to apply something similar to @Html.Raw to the asp-for attribute value in the label tag above so it will show as:

Corporation /
Enterprise

Or I need to write my own label class so it will do the encoding?

Thank you.

0 Answers
Related