Tuesday, June 4, 2019

How to embedded HTML code in the asp.net MVC resource file?

currently i am building an web application to support both English and French users.

we have a some words that already under registered trade mark My Trade Mark®. unfortuately the registered in not show in superscript.

we have to use the following HTML code to show registered trade mark in superscript.

<sup>&reg;</sup> 

since <> have been used for open and close tag

we have use the following code to embedded HTML code in the resource file.

 <data name="MyTradeMark" xml:space="preserve">
    <value>My Trade Mark<![CDATA[<sup>&reg;</sup>]]></value>
  </data>


in the MVC page we can use the code below to localize the text.

@Html.Raw(MVCPage_ascx.MyTradeMark)


in ASP.NET page. we just need to put this code in aspx page

<%=@MVCPage_ascx.MyTradeMark%>

No comments:

Post a Comment