Editor Showing html tags reciebed from the controller.

5 posts, 1 answers
  1. Javier
    Javier avatar
    2 posts
    Member since:
    May 2013

    Posted 28 May 2013 Link to this post

    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
  2. Answer
    Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 28 May 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Javier
    Javier avatar
    2 posts
    Member since:
    May 2013

    Posted 28 May 2013 Link to this post

    Thank you so much Dimo.
  5. Tony
    Tony avatar
    13 posts
    Member since:
    Jul 2013

    Posted 03 Aug 2013 Link to this post

    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?



  6. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 05 Aug 2013 Link to this post

    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!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready