This is a migrated thread and some comments may be shown as answers.

Classic editor showing HTML tags

1 Answer 1017 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 27 Apr 2015, 03:27 AM

This is the value that's in the database and being passed to the view:

<p>this is a paragraph</p>

 This is what is showing in the Editor:

 <p>this is a paragraph</p>

I've searched online for the solution, and found that I need to set encoded = false in the editor, and [AllowHtml] attribute to field in the class. I did that, but am still having the issue. 

Here is the code in the view for the editor -- the first line appends a text area into a div:

 

        $("#divParagraphs").append('<div class="search-box"><div class="row"><div class="col-md-12">Paragraph:</div></div><div class="row"><div class="col-md-12"><textarea class="Paragraph" id=' + id + '></textarea><input type="hidden" id=' + id + '_id value=' + pid + ' /></div></div></div>');

         $("#" + id).kendoEditor({
            encoded: false,
            tools: [
                "bold",
                "italic",
                "underline",
                "strikethrough",
                "justifyLeft",
                "justifyCenter",
                "justifyRight",
                "justifyFull",
                "createLink",
                "unlink",
                "insertImage",
                "createTable",
                "addColumnLeft",
                "addColumnRight",
                "addRowAbove",
                "addRowBelow",
                "deleteRow",
                "deleteColumn",
                "foreColor",
                "backColor"
            ]
        });

 I'm out of ideas :-) Please help.

 Thanks,

Mike

 

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 28 Apr 2015, 03:36 PM
Hi Mike,

The Razor view engine encodes HTML strings automatically. Please make sure that the value, which is passed to the Editor, is not double encoded.

http://www.telerik.com/forums/saving-as-html-viewing-as-html

Also, keep in mind that a similar issue can occur during validation:

http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/editor/overview#kendo-ui-editor-shows-html-tags-after-validation

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Editor
Asked by
Mike
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or