Getting issue in disable auto correction of html elements

2 posts, 0 answers
  1. Aminul
    Aminul avatar
    11 posts
    Member since:
    Jan 2014

    Posted 17 Dec 2014 Link to this post

    Hello Expert,

    I am getting an issue in disable auto correction of html element. 
    I have a RadEditor where I want to get and set any none valid/formatted html element as like "<noclick> Somethings".
    I tried to do this, my code taking none valid/formatted html element as like "<div>Hello World" and giving this same value in server side and I can save this value in database. Then I retrieve this html element from database and bid this html element to RadEditor.Content. But when I browse this page; I can see this value are showing as  <div>Hello World</div> in RadEditor . That's mean its adding end tag to correct html format. But I don't need to add this end tag in my html elements.

    Here is my code:

    <telerik:RadEditor ID="txtTextScript" runat="server" Font-Size="Larger" EditModes="Html" ContentAreaMode="Div" ContentFilters="None" Height="100" Width="349px">
                  <telerik:EditorToolGroup >

    protected void Page_Load(object sender, EventArgs e){
    I tried by following this link but still not working

    I am waiting for a quick response from someone.



  2. Niko
    Niko avatar
    383 posts

    Posted 22 Dec 2014 Link to this post

    Hello Aminul,

    The Editor control from the Telerik UI for ASP.NET AJAX relies on the editable content capabilities of browsers. In that respect all content is rendered on the page and thus translated as HTML. This forces the browser parsing and rendering machines to evaluate the content and try to fix any missing HTML content.

    You will get the same result if you try to add invalid HTML to an existing DOM element:
    $get("content").innerHTML = "<div>content";

    On the other hand, if you wish the content in the Design mode to appear as "<div>content", then you should encode it on the server:
    theEditor.Content = HttpUtility.HtmlEncode(content);

    Hope this helps.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Telerik UI for ASP.NET Core is out
Back to Top