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

Editor Showing html tags reciebed from the controller.

4 Answers 865 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Javier
Top achievements
Rank 1
Javier asked on 28 May 2013, 12:16 PM
Hello guys,

I have a View with a Kendo Editor. 

@(Html.Kendo().Editor()
      .Name("editor")
      
      .HtmlAttributes(new { style = "width: 740px;height:440px" })
      .Value(@<text>@ViewBag.FirstText</text
               
              ))
Well, in the controller I have the following:

public ActionResult ShowEditor(int id)
{
 
            ViewBag.FirstText = "<a>bbb</a>";
 
    return View();
}

When I run the project and go to the View, I see in the editor the full text "<a>bbb</a>".

Any work around to solve it?

Regards

4 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 28 May 2013, 03:14 PM
Hi Javier,

The Editor configuration is incorrect. Please remove @<text> and </text>. They are needed only when supplying HTML markup directly.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Javier
Top achievements
Rank 1
answered on 28 May 2013, 06:33 PM
Thank you so much Dimo.
0
Tony
Top achievements
Rank 1
answered on 03 Aug 2013, 06:07 AM
I am also having this problem, but mine doesn't have the <text> tags.

My code looks like this:
<ul style="float:left;">
 <li>
    <label for="content" class="required">Content:</label>
            @(Html.Kendo().Editor()
               .Name("content")
               .HtmlAttributes(new { style = "width: 740px;height:289px" })
               .Value(ViewBag.Content)
                )
 </li>
</
ul>
<
ul style="float:left;">
 <li><br />
   <input type="submit" value="Send" />
 </li>
</ul>

For the code that loads into the page it looks like this:
public ActionResult Email()
{
    ViewBag.Content = "<p><img alt=\"Editor for ASP.NET MVC logo\" src=\"http://www.kendoui.com/Image/kendo-logo.png\" style=\"margin-right:auto;margin-left:auto;display:block;\" /></p><p>Kendo UI Editor allows your users to edit HTML in a familiar, user-friendly way.<br />In this version, the Editor provides the core HTML editing engine, which includes basic text formatting, hyperlinks, lists, and image handling. The widget <strong>outputs identical HTML</strong> across all major browsers, follows accessibility standards and provides API for content manipulation. </p><p>Features include:</p><ul><li>Text formatting &amp; alignment</li><li>Bulleted and numbered lists</li><li>Hyperlink and image dialogs</li><li>Cross-browser support</li><li>Identical HTML output across browsers</li><li>Gracefully degrades to a <code>textarea</code> when JavaScript is turned off</li></ul><p>Read <a href=\"http://www.kendoui.com/documentation/introduction.aspx\">more details</a> or send us your <a href=\"http://www.kendoui.com/forums.aspx\">feedback</a>! </p>";
 
    return View();
}
This is the html that comes from the KendoUI Editor example.

It outputs the following in the editor box:
<p><img alt="Editor for ASP.NET MVC logo" src="http://www.kendoui.com/Image/kendo-logo.png" style="margin-right:auto;margin-left:auto;display:block;" /></p><p>Kendo UI Editor allows your users to edit HTML in a familiar, user-friendly way.<br />In this version, the Editor provides the core HTML editing engine, which includes basic text formatting, hyperlinks, lists, and image handling. The widget <strong>outputs identical HTML</strong> across all major browsers, follows accessibility standards and provides API for content manipulation. </p><p>Features include:</p><ul><li>Text formatting & alignment</li><li>Bulleted and numbered lists</li><li>Hyperlink and image dialogs</li><li>Cross-browser support</li><li>Identical HTML output across browsers</li><li>Gracefully degrades to a <code>textarea</code> when JavaScript is turned off</li></ul><p>Read <a href="http://www.kendoui.com/documentation/introduction.aspx">more details</a> or send us your <a href="http://www.kendoui.com/forums.aspx">feedback</a>! </p>
When I put content between <text> tags and post back, the content doesn't render properly after the postback, either. It shows the HTML content before but only shows tags after postback.

Any ideas how I can fix this?



0
Dimo
Telerik team
answered on 05 Aug 2013, 10:17 AM
Hi Tony,

Please refer to the following forum post for more information.

http://www.kendoui.com/forums/kendo-ui-web/editor/problems-with-editor-showing-html-tags.aspx#JsJ0tK_u7UmCRFMSEY92JA

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
Javier
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Javier
Top achievements
Rank 1
Tony
Top achievements
Rank 1
Share this question
or