how do i convert html edited text in C# loop to fully formatted text on the page

a. 1

I have a list of strings that i would like to display in cshtml page (Asp.net C#) ,the problem is instead of having html tags in my text i want to display the text formatted on the page when i run the website. the output is: <p><strong>some </strong><i>data</i></p> it should be: some data

this is the C# code in cshtml page:

@foreach (var item in Model)
        {
            <div>@item.content</div>
        }
Yong Shun

You need to use Html.Raw() so it renders as IHtmlString in HTML instead of string.

<div>@Html.Raw(item.content)</div>

Rendered HTML

<div><p><strong>some </strong><i>data</i></p></div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I convert a formatted email into plain text in Java?

how to convert a column of text with html tags to formatted text in vba in excel

How do i convert a text to column code block into a loop?

How do i get the current text of a QCombobox edited?

How do I create a textbox with prefilled text that can be edited?

Python : How to convert markdown formatted text to text

How to convert formatted text in a Powerpoint table cell to HTML

Html to Formatted Text C#

How do I convert HTML markup to just raw text?

How do I convert html text to organized json array?

How do I convert lines of text into HTML links using python?

C# - how can i convert “text text 542050.0000 text text” to “text text 542050 text text”?

Convert formatted email (HTML) to plain Text?

How do I make placeholder text permanent and formatted correctly?

How do I convert a Text to a bytestring Builder?

How do I convert numbers into text? (In mySQL)

How do I convert hexadecimal string to text

How do I convert Dynamic Javascript to Text?

How do I convert vector to single text?

How do I save text to the page

How do I add text in this loop in javascript?

Html display formatted text

Parsing HTML with formatted text

How to convert HTML to text?

How can I display formatted text in a TextView?

How do I retain the decimal numbers during text preprocessing in python?(Edited)

how to get the currently edited text from textbox and not the page load contents

How do I align Input HTML tag and Text Area in HTML and CSS (Styling a contact page)

How to display html formatted text in text area of java application?