locked
Writing text with HTML markup to a page RRS feed

  • Question

  • User-1794695938 posted

    I thought this would be simple but I can't find an answer that works for me.  I have a web page that displays a blog article stored in a SQL DB.  The article contains HTML markup so it will display formatted, as intended.  Everything I have tried, just displays the HTML as text.  Here is my View code snippet. 

    <section class="section-article js-section-blog">
           <div class="row">
               <div class="col span-2-of-2">
                   <div id="Article" class="article-text-box">
                  @Model.Post
                   </div>  
               </div>
           </div>
       </section>

     

    Sunday, September 29, 2019 8:24 PM

Answers

  • User61956409 posted

    Hi USMC6072,

    verything I have tried, just displays the HTML as text.  Here is my View code snippet. 

    <section class="section-article js-section-blog">
           <div class="row">
               <div class="col span-2-of-2">
                   <div id="Article" class="article-text-box">
                  @Model.Post
                   </div>  
               </div>
           </div>
       </section>

    You can try modify the code, like below.

    @Html.Raw(Model.Post)

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 30, 2019 6:10 AM

All replies

  • User61956409 posted

    Hi USMC6072,

    verything I have tried, just displays the HTML as text.  Here is my View code snippet. 

    <section class="section-article js-section-blog">
           <div class="row">
               <div class="col span-2-of-2">
                   <div id="Article" class="article-text-box">
                  @Model.Post
                   </div>  
               </div>
           </div>
       </section>

    You can try modify the code, like below.

    @Html.Raw(Model.Post)

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 30, 2019 6:10 AM
  • User-1794695938 posted

    Worked perfectly.  Thanks Fei!

    Tuesday, October 1, 2019 1:32 AM