HTML Tags in Blazor variables RRS feed

  • Question

  • User1640282781 posted

    In my .razor file, this piece shows up correctly:

    <td><b>My</b> house</td>  (meaning the "My" shows in bold text)

    but this:

    string myhouse = "<b>My</b> house";


    shows up as <b>My</b> house

    I just got started with Blazor, but I could not find this discussed anywhere.

    Many thanks,


    Saturday, April 11, 2020 9:18 PM

All replies

  • User1760891592 posted
    Check this MarkupString

    Sunday, April 12, 2020 5:26 AM
  • User-857013053 posted

    You can try this


    @functions {

    string myhouse ="<b>My</b>house";


    Friday, May 1, 2020 6:34 AM