Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Editor / Built-in Content Filters

Filters in RadEditor are small code snippets, which are called in a sequence to process the editor content, when the mode (Html / Design / Preview) is switched or the page is submitted. This example demonstrates the use of the editor's built-in content filters:
   
  
  
   
Built-in filters

  • Built-in content filters

    Filters in RadEditor are small code snippets, which are called in a sequence to process the editor content, when the mode (html / design / preview) is switched. This example demonstrates the use of the editor's built-in content filters:

    • RemoveScripts: this filter removes script tags from the editor content. Disable the filter if you want to insert script tags in the content.
    • EncodeScripts: this filter encodes all script tags from the content.
    • MakeUrlsAbsolute: this filter makes all URLs in the editor content absolute (e.g. "http://server/page.html" instead of "page.html"). This filter is DISABLED by default.
    • FixUlBoldItalic: this filter changes the deprecated u tag to a span with CSS style.
    • IECleanAnchors Internet Explorer only - this filter removes the current page url from all anchor(#) links to the same page.
    • FixEnclosingP: this filter removes a parent paragraph tag if the whole content is inside it.
    • MozEmStrong: this filter changes b to strong and i to em in Mozilla browsers.
    • ConvertFontToSpan: this filter changes deprecated font tags to compliant span tags.
    • OptimizeSpans: this filter changes removes unneeded span elements.
    • ConvertToXhtml: this filter converts the HTML from the editor content area to XHTML.
    • IndentHTMLContent: this filter indents the HTML content so it is more readable when you view the code.
    • ConvertCharactersToEntities: this filter converts reserved characters to their html entity names.
    • PdfExportFilter: this filter fixes some pdf export issues.
    • ConvertInlineStylesToAttributes: this filter converts XHTML compliant inline style attributes to Email compliant element attributes.
    • DefaultFilters: the default editor behavior. All content filters except MakeUrlsAbsolute are activated.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="C#" Theme="Default" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Editor.ContentFilters.DefaultCS" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <qsf:headtag id="Headtag1" runat="server"/>
    </head>
    <body class="BODY">
        <form id="form1" runat="server">
        <qsf:header id="Header1" runat="server" navigationlanguage="c#"/>
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" />    
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All"></telerik:RadFormDecorator>
        <table cellspacing="0" cellpadding="0">
        <tr>
            <td style="vertical-align: top;">
                 
                <telerik:RadAjaxManager ID="RadAjax1" runat="server" >
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="SetFiltersButton" >
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="LoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        <telerik:AjaxSetting AjaxControlID="RestoreDefaults" >
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="LoadingPanel1" />
                                <telerik:AjaxUpdatedControl ControlID="FiltersList" LoadingPanelID="LoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                    </AjaxSettings>
                </telerik:RadAjaxManager>
                <qsf:InformationBox ID="InformationBox1" runat="server">
                                Filters in RadEditor are small code snippets, which are called in a sequence
                                to process the editor content, when the mode (Html / Design / Preview) is switched or the page is submitted.
                                This example demonstrates the use of the editor's built-in content filters:
                </qsf:InformationBox>
                                
                        <telerik:radeditor runat="server" ID="RadEditor1" Height="330" EnableResize="false" SkinID="DefaultSetOfTools">
                            <Modules>
                                <telerik:EditorModule Name="RadEditorStatistics" DockingZone="Bottom" Visible="true" Enabled="true" />
                                <telerik:EditorModule Name="RadEditorDomInspector" Visible="false" Enabled="true" />
                                <telerik:EditorModule Name="RadEditorNodeInspector" Visible="false" Enabled="true" />
                                <telerik:EditorModule Name="RadEditorHtmlInspector" Visible="false" Enabled="true" />
                            </Modules>
                            <Content>
                               <img alt="product logo" src="../../Img/productLogoLight.gif" />is the successor of the well known industry standard Editor for ASP.NET. The tight integration with ASP.NET AJAX and the powerful new capabilities make Telerik's WYSIWYG Editor a flexible and lightweight component, turning it into the fastest loading Web Editor. Among the hottest features are:
                                <ul>
                                    <li><em>Single-file, drag-and-drop deployment</em></li>
                                    <li><em>Built on top of ASP.NET AJAX</em></li>
                                    <li><em>Unmatched loading speed with new semantic rendering </em></li>
                                    <li><em>Full keyboard accessibility</em></li>
                                    <li><em>Flexible Skinning mechanism</em></li>
                                    <li><em>Simplified and intuitive toolbar configuration</em></li>
                                    <li><em>Out-of-the-box XHTML-enabled output</em></li>
                                </ul>
                            </Content>
                        </telerik:radeditor>
                
            </td>
            <td style="padding: 25px 0 0 8px; vertical-align: top;" >
                <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Enabled="true" Title="Built-in filters"
                 Expanded="true" style="text-align:left;" HorizontalAlign="Right" Width="190">
                          <div style="padding: 3px;">
                                <asp:CheckBoxList ID="FiltersList" runat="server" >
                                    <asp:ListItem Text="RemoveScripts" Value="RemoveScripts" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="EncodeScripts" Value="EncodeScripts" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="MakeUrlsAbsolute" Value="MakeUrlsAbsolute" Selected="false"></asp:ListItem>
                                    <asp:ListItem Text="FixUlBoldItalic" Value="FixUlBoldItalic" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="FixEnclosingP" Value="FixEnclosingP" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="IECleanAnchors" Value="IECleanAnchors" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="MozEmStrong" Value="MozEmStrong" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="ConvertFontToSpan" Value="ConvertFontToSpan" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="OptimizeSpans" Value="OptimizeSpans" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="ConvertToXhtml" Value="ConvertToXhtml" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="ConvertCharactersToEntities" Value="ConvertCharactersToEntities" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="PdfExportFilter" Value="PdfExportFilter" Selected="false"></asp:ListItem>
                                    <asp:ListItem Text="IndentHTMLContent" Value="IndentHTMLContent" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="ConvertInlineStylesToAttributes" Value="ConvertInlineStylesToAttributes" Selected="false"></asp:ListItem>
                                </asp:CheckBoxList>
                                <div style="padding:5px">
                                    <asp:Button ID="SetFiltersButton" runat="server" Text="Set Built-in Filters" OnClick="SetFiltersButton_Click" />
                                </div>
                                <div style="padding:5px">
                                    <asp:Button ID="RestoreDefaults" runat="server" Text="Restore Defaults" OnClick="RestoreButton_Click" />
                                </div>
                            </div>

               </qsf:ConfiguratorPanel>
                <telerik:RadAjaxLoadingPanel Skin="Default" ID="LoadingPanel1" runat="server">
                 </telerik:RadAjaxLoadingPanel>

                </td>
            </tr>
        </table>
        
        

      

        
        <qsf:footer runat="server" id="Footer1"/>
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451