Not able to use Script tags in Rad Telerik HTML editor

2 posts, 0 answers
  1. balaramesh t
    balaramesh t avatar
    1 posts
    Member since:
    Apr 2010

    Posted 22 Jan 2014 Link to this post

    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?
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 23 Jan 2014 Link to this post

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