title: Get and set html format using tinyMCE in ASP.NET MVC 5
body: <p>I have a project that is bilingual and I have a story for each language. I want to use TinyMCE to get formatted Html Text and also set those Textareas from the database.</p>
  
  <p>This is my model for blogs:</p>
  
  <p><strong>Model</strong>:</p>
  
  <pre><code>    [Required(ErrorMessage = "Please add the news context")]
      [MinLength(10, ErrorMessage = "The length of news context must be 10 characters atleast")]
      [Display(Name = "News Context")]
      [UIHint("tinymce_jguery_full"), AllowHtml]
      public string newsContent { get; set; }
  
      [Required(ErrorMessage = "شرح خبر نمی تواند خالی باشد")]
      [MinLength(10, ErrorMessage = "حداقل طول شرح خبر 10 حرف است")]
      [Display(Name = "شرح خبر")]
      [UIHint("tinymce_jguery_full"), AllowHtml]
      public string newsContentFa { get; set; }
  </code></pre>
  
  <p>I can also successfully fetch that blog with a <code>service.Get_Category_List()</code> method as follow code in <code>NewsmanagementControler</code></p>
  
  <p><strong>Controller</strong>:</p>
  
  <pre><code> public ActionResult Edit(int id)
   {
          using (DbModel db = new DbModel())
          {
              News SelectedNews = new News();
              var news = service.GetNews_ById(id);
              return View(news);
          }
   }
  </code></pre>
  
  <p>And finally in the View I set tinyMCE from the raw Html fetched from database as following code:</p>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;script src='//cdn.tinymce.com/4/tinymce.min.js'&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      tinymce.init({
          selector: 'textarea',
          mode: "textareas",
          theme: 'modern',
          entity_encoding: 'raw',
          height: 300,
          plugins: [
              'advlist autolink link lists charmap print preview hr anchor pagebreak spellchecker',
              'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime nonbreaking',
              'save table colorpicker contextmenu directionality paste textcolor image'
          ],
          content_css: '../../Content/css/tinyMCE.css',
          toolbar: 'insertfile undo redo | styleselect | fontselect | sizeselect | fontsizeselect bold italic underline | alignleft aligncenter alignright alignjustify | ltr rtl | bullist numlist outdent indent | link | print preview fullpage | forecolor backcolor image',
          fontsize_formats: "8pt 10pt 12pt 14pt 16pt 18pt 20pt 24pt 36pt",
          font_formats: "Arial=arial,helvetica,sans-serif;" +
              "Arial Black=arial black,avant garde;" +
              "B Yekan=BYekan" +
              "Courier New=courier_newregular,courier;" +
              "Impact=impactregular,chicago;" +
              "Tahoma=tahoma,arial,helvetica,sans-serif;" +
              "Times New Roman=times new roman,times;" +
              "Verdana=verdana,geneva;" +
              "Webdings=webdings;" +
              "Wingdings=wingdings,zapf dingbats",
          draggable_modal: true
      });
  &lt;/script&gt;
  @using (Html.BeginForm("Edit", "NewsManagement", FormMethod.Post))
  {
          &lt;div class="col-md-12 ltr"&gt;
              &lt;br /&gt;
              &lt;label for="MainContent"&gt;Context of Blog&lt;/label&gt;
              @Html.TextAreaFor(m =&gt; m.news.newsContent, new { @class = "fullWidth tiny", placeholder = "Main Content" })
              @Html.ValidationMessageFor(m =&gt; m.news.newsContent, "", new { @class = "redError" })&lt;br /&gt;
              &lt;br /&gt;
          &lt;/div&gt;
          &lt;div class="col-md-12 rtl"&gt;
              &lt;br /&gt;
              &lt;label for="MainContentFa"&gt;شرح مطلب&lt;/label&gt;
              @Html.TextAreaFor(m =&gt; m.news.newsContentFa, new { @class = "fullWidth tiny rtl", placeholder = "شرح مطلب" })
              @Html.ValidationMessageFor(m =&gt; m.news.newsContentFa, "", new { @class = "redError" })&lt;br /&gt;
          &lt;/div&gt;
  }
  </code></pre>
  
  <p>I don't have any problem with save raw Html tinyMCE but for showing my stored raw html in database, there is a problem - as seen in this screenshot:</p>
  
  <p><a href="https://i.stack.imgur.com/sUgaz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sUgaz.jpg" alt="enter image description here"></a></p>
  
  <p>As you can see the raw HTML doesn't render in TinyMCE. I searching everywhere on google and here too, but there isn't any right answer according to my problem.      </p>