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

Getting issue in disable auto correction of html elements

1 Answer 70 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Aminul asked on 17 Dec 2014, 01:38 PM
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.



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Dec 2014, 09:53 AM
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.

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question