How to save formatted text in the database

7

I'm using TinyMCE for text editing on my site. However, I'm doubtful to save the formatted text in the database and then display it the way the user typed. (paragraphs, font color, etc.). Is there any way to do this? I am using asp.net mvc with sql database server.

    
asked by anonymous 02.12.2014 / 00:34

1 answer

6

In my projects, I jot down the text field with HTML as follows in Models :

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

To view, use View :

@Html.Raw(Model.Description)
    
02.12.2014 / 02:56