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

Not able to use Script tags in Rad Telerik HTML editor

1 Answer 68 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
balaramesh t
Top achievements
Rank 1
balaramesh t asked on 22 Jan 2014, 01:36 PM
We have used Rad Telerik HTML editor control in our CMS project.  We cant able to add <script> tags using the editor.
We need to use <script> tags in the CMS content. Can any one please guide us on this?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Jan 2014, 12:35 PM
Hello,

You need to make sure the RemoveScripts and EncodeScripts filters are disabled before attempting to add scripts to the content. If you need to preset content with scripts, you should first disable the filters. For example:
protected void Page_Load(object sender, EventArgs e)
{
    RadEditor1.DisableFilter(EditorFilters.RemoveScripts);
    RadEditor1.DisableFilter(EditorFilters.EncodeScripts);
    string initialContent = @"<strong>some bold text</strong><br /><em>some italic text</em>
        <script type=""text/javascript"">
            alert(1);
        </script>";
    RadEditor1.Content = initialContent;
}



Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Documentation and Tutorials
Asked by
balaramesh t
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or