Live Chat Icon For mobile
Live Chat Icon

Is there any equivalent of HTML.RAW in Blazor?

Platform: Blazor| Category: General

To render raw HTML in Blazor, wrap the HTML content using the MarkupString type. This allows the HTML or SVG to be rendered as part of the DOM. 

 @page "/"
  
  
 @((MarkupString)myMarkup)
  
 @code {
     private string myMarkup =
         "<p class='markup'>This is a <em>markup string</em>.</p>";
 } 

Refer to the Blazor documentation for more information. 

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.