New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Using Scripts via Server-side Content property

How-to

Enable Script tags in the content, set via the Server-side Content property of the RadEditor control

Solution

You should disable the RemoveScripts and the EncodeScripts built-in content filters on the Page_Load event and then set the desired Script in the content.

<telerik:RadEditor runat="server" ID="RadEditor1">
</telerik:RadEditor>
    protected void Page_Load(object sender, EventArgs e)
    {
        RadEditor1.DisableFilter(EditorFilters.RemoveScripts);
        RadEditor1.DisableFilter(EditorFilters.EncodeScripts);

        string initialContent = @"
<script type=""text/javascript"">
       alert(1);
</script>";

        RadEditor1.Content = initialContent;
    }
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        RadEditor1.DisableFilter(EditorFilters.RemoveScripts)
        RadEditor1.DisableFilter(EditorFilters.EncodeScripts)

        Dim initialContent As String =
"<script type=""text/javascript"">" +
       "alert(1);" +
"</script>"

        RadEditor1.Content = initialContent
    End Sub
In this article
Not finding the help you need? Improve this article