How to save formatted text to database

Asked

Viewed 1,275 times

7

I’m using Tinymce to edit texts on my website. However, I am doubtful to save the formatted text in the database and then display it the way the user typed it. (paragraphs, font color, etc.). Is there any way to do this? I am using Asp.net mvc with sql database server.

1 answer

6


In my projects, I note the HTML text field as follows in Models:

    [Required]
    [AllowHtml]
    [DataType(DataType.MultilineText)]
    [Display(Name = "Description", ResourceType = typeof(Resources.Language))]
    public String Description { get; set; }

For display, use on View:

@Html.Raw(Model.Description)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.