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

Editable DIV Content Area

  • Show/Hide Border
  • Table Properties
  • Delete Table
  • Row
    • Insert Row Above
    • Insert Row Below
    • Delete Row
  • Column
    • Insert Column to the Left
    • Insert Column to the Right
    • Delete Column
  • Cell
    • Merge Cells Horizontally
    • Merge Cells Vertically
    • Split Cell Horizontally
    • Split Cell Vertically
    • Delete Cell
  • Cell Properties
  • Table Properties
  • Properties...
  • Image Map Editor
  • Properties...
  • OpenLink
  • Remove Link
  • Insert Select
  • Cut
  • Copy
  • Paste
  • Paste from Word
  • Paste Plain Text
  • Paste As Html
  • Paste Html
  • Demo Configurator
  • Change Edit Mode



    Note: At least one EditMode should be checked

  • Choose tools file



  • Enable/Disable RadEditor


  • Toolbar Mode

  • Enable / Disable AutoResizeHeight


  • New Lines as



This demo demonstrates how to render the RadEditor's content area as an editable DIV element, rather than the default IFRAME content area mode.

ContentAreaMode - This property specifies if the content area element of RadEditor is editable IFRAME or DIV. There are two values available for the property: "Iframe" and "Div". The default value is "Iframe". These are the main differences between Div and Iframe content area modes:

  • When "Iframe" mode is used the content area has a separate document, which does not automatically inherit the current page style sheets. In this mode the parent page CSS styles are manually copied to the document of the Iframe element. This might decrease the loading performance of the control if multiple styles are defined. In "Div" mode all the styles from the parent page are automatically applied to the content.
  • You cannot edit a full HTML page in "Div" mode because the <html> element cannot be nested inside a <div> element.
  • In "Div" mode the content area is part of the current page, which provides better support for https and document.domain cross server scripting.
  • The "Div" mode offers better compatibility with some screen readers.
  • The "Div" mode supports faster implementation of AutoResizeHeight functionality, which is based on the built-in resize implementation of the DIV element.
  • The "Div" content area mode functionality is based on the contentEditable property of the DIV element.  All major browsers support this property now, including Firefox 3, Safari 3, Opera 10, Google Chrome, and Internet Explorer (since 5.5), however some older browsers do not.
  • One major difference between both modes is that in "Iframe" mode the user can insert FORM tags without breaking the page.
  • Div mode should be used by experienced users only who know and understand the benefits and the potential problems that may occur.
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Theme="Default" Language="vb" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb"Inherits="Telerik.Web.Examples.Editor.ContentAreaModeDiv.DefaultVB"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="../Common/styles.css" rel="stylesheet" type="text/css" />
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
        <div class="demo-container">
            <telerik:RadEditor RenderMode="Lightweight" ContentAreaMode="Div" runat="server" ID="RadEditor1" SkinID="DefaultSetOfTools"
                Height="515px" CssClass="centered-editor">
                <ImageManager ViewPaths="~/Editor/images/UserDir/Marketing,~/Editor/images/UserDir/PublicRelations"
                    UploadPaths="~/Editor/images/UserDir/Marketing,~/Editor/images/UserDir/PublicRelations"
                    DeletePaths="~/Editor/images/UserDir/Marketing,~/Editor/images/UserDir/PublicRelations" />
            </telerik:RadEditor>
        </div>
    </div>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="CheckBoxListEditMode">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="CheckBoxListEditMode" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadioButtonToolsFile">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadioButtonToolsFile" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadioButtonListAutoResizeHeight">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadioButtonListAutoResizeHeight" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadioButtonListEnabled">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadioButtonListEnabled" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="NewLineModeButtonList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="NewLineModeButtonList" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
    </telerik:RadAjaxLoadingPanel>
    <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1">
        <Views>
            <qsf:View runat="server">
                <qsf:ConfiguratorColumn runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <qsf:CheckBoxList runat="server" ID="CheckBoxListEditMode" Label="Change Edit Mode"
                                OnSelectedIndexChanged="CheckBoxListEditMode_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="Design" Selected="True">Design Mode</asp:ListItem>
                                <asp:ListItem Value="Html" Selected="True">Html Mode</asp:ListItem>
                                <asp:ListItem Value="Preview" Selected="True">Preview Mode</asp:ListItem>
                            </qsf:CheckBoxList>
                            <p>
                                <em><strong>Note</strong>: At least one EditMode should be checked</em>
                            </p>
                        </li>
                        <li>
                            <qsf:RadioButtonList runat="server" ID="RadioButtonToolsFile" Label="Choose tools file"
                                OnSelectedIndexChanged="RadioButtonToolsFile_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="FullSet">Full set of tools</asp:ListItem>
                                <asp:ListItem Value="Default" Selected="True">Default</asp:ListItem>
                                <asp:ListItem Value="BasicTools">Basic toolset</asp:ListItem>
                            </qsf:RadioButtonList>
                        </li>
                        <li>
                            <qsf:RadioButtonList runat="server" ID="RadioButtonListEnabled" Label="Enable/Disable RadEditor"
                                OnSelectedIndexChanged="RadioButtonListEnabled_SelectedIndexChanged" AutoPostBack="true"
                                Orientation="Horizontal">
                                <asp:ListItem Value="Enable" Selected="true">Enable</asp:ListItem>
                                <asp:ListItem Value="Disable">Disable</asp:ListItem>
                            </qsf:RadioButtonList>
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <h4>Toolbar Mode</h4>
                            <qsf:ComboBox runat="server" ID="ChooseToolbarMode" OnTextChanged="ChooseToolbarMode_TextChanged"
                                AutoPostBack="true">
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Selected="True" Text="Default" Value="Default"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="PageTop" Value="PageTop"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="ShowOnFocus" Value="ShowOnFocus"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="Floating" Value="Floating"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="RibbonBar" Value="RibbonBar"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="RibbonBarFloating" Value="RibbonBarFloating"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="RibbonBarPageTop" Value="RibbonBarPageTop"></telerik:RadComboBoxItem>
                                    <telerik:RadComboBoxItem runat="server" Text="RibbonBarShowOnFocus" Value="RibbonBarShowOnFocus"></telerik:RadComboBoxItem>
                                </Items>
                                <CollapseAnimation Duration="200" Type="OutQuint"></CollapseAnimation>
                            </qsf:ComboBox>
                        </li>
                        <li>
                            <qsf:RadioButtonList Orientation="vertical" OnSelectedIndexChanged="RadioButtonListAutoResizeHeight_SelectedIndexChanged"
                                ID="RadioButtonListAutoResizeHeight" runat="server" AutoPostBack="True" Label="Enable / Disable AutoResizeHeight">
                                <asp:ListItem Value="True">Auto Resize to Fit Content Height (no scrollers)</asp:ListItem>
                                <asp:ListItem Selected="True" Value="False">Fixed-height content Area (with scrollers)</asp:ListItem>
                            </qsf:RadioButtonList>
                        </li>
                        <li>
                            <qsf:RadioButtonList runat="server" ID="NewLineModeButtonList" Label="New Lines as"
                                OnSelectedIndexChanged="NewLineModeList_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="Br">Breaks</asp:ListItem>
                                <asp:ListItem Value="P" Selected="true">Paragraphs</asp:ListItem>
                                <asp:ListItem Value="Div">Divs</asp:ListItem>
                            </qsf:RadioButtonList>
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance