asp.net mvc - Trouble with CKEditor when displaying output -


i'm using ckeditor along asp.net mvc, there's strange problem : if format text (e.g. apply boldness, make italic, or make list) when there's error , content must post textarea, displayed html text - "ul li " , on instead of being styled again (bold, italic , on).

i've applied options in config:

config.htmlencodeoutput = true; // avoid text being interpreted attack  config.entermode = ckeditor.enter_br; // in order not place tags arround text   config.basicentities = false; // display spaces instead of   , on... 

i tried built in functions in mvc server.htmldecode , httputility.decode nothing seems work. solutions other editors work fine mvc accepted.

here .cshmtl file:

@{     viewbag.title = "ckeditor"; }  @model htmltexteditorsdemos.models.simplemodel  <h2>ckeditor</h2>  <script src="~/scripts/ckeditor.js"></script>  @using (html.beginform()) {     @html.textareafor(x => x.text, new { @class = "ckeditor" })     <input type="submit" value="send" /> } 

in action method nothing return data again testing purposes:

[httppost] public actionresult index(simplemodel model) {     //model.text = server.htmldecode(model.text);     return view(model); } 

the simplemodel class test model class 1 property - text.

you can try this

@foreach (var item in model) {     <tr>          <td>             @html.displayfor(modelitem => item.title)         </td>         <td>            @{     string description = server.htmldecode(item.description);            }             @html.raw(description)          </td>         <td>             @html.displayfor(modelitem => item.note)         </td>         <td>             <img src="~/img/uploads/@item.pic" width="150" height="120" />         </td>      </tr> } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -