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 / Displaying RadEditor as a TextBox

Registration Form
First Name:
Last Name:
Occupation:
Resume:
   
  
 
 
   
Click in the content area to show the toolbar.
   

  • Displaying RadEditor as a TextArea/TextBox

    In order to produce a textbox-like RadEditor follow the steps below:
    1. Register the following css classes:

      <style type="text/css">    
          /* The following CSS needs to be copied to the page to produce textbox-like RadEditor */
          
          .reLeftVerticalSide, 
          .reRightVerticalSide, 
          .reToolZone,
          .reToolCell
          {
              backgroundwhite !important;
          }
          
          .reToolCell
          {
              displaynone\9 !important/* for all versions of IE in order to prevent border bottom disappearing */
          }
          
          .reContentCell
          {
              border-width0 !important;
          }
          
          .formInput
          {
             bordersolid 1px black;
          }
          
          .RadEditor
          {
              filter: chroma(color=c2dcf0);
          }
          
          .reWrapper_corner,
          .reWrapper_center 
          {
              displaynone !important/* for FF */            
          }
          
          td.reWrapper_corner,
          td.reWrapper_center 
          {
              displayblock\9 !important/* for all versions of IE */            
          }
          
          </style>
    2. Hide the Html and Preview Mode buttons by setting: EditModes="Design"
       
    3. Set the ToolbarMode property to ShowOnFocus: ToolbarMode="ShowOnFocus"
       
    4. Load only a few buttons in the Toolbar. In the example, the editor loads BasicTools.xml via its ToolsFile property: ToolsFile="~/Editor/Examples/EditorAsTextBox/BasicTools.xml"
       
    5. Set the toolbar width via the ToolsWidth property, e.g. ToolsWidth="330px"

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Theme="Default" Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Editor.Default.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"/>
        <style type="text/css">    
        /* The following CSS needs to be copied to the page to produce textbox-like RadEditor */
        
        .reLeftVerticalSide,
        .reRightVerticalSide,
        .reToolZone,
        .reToolCell
        {
            background: white !important;
        }
        
        .reToolCell
        {
            display: none\9 !important; /* for all versions of IE in order to prevent border bottom disappearing */
        }
        
        .reContentCell
        {
            border-width: 0 !important;
        }
        
        .formInput
        {
           border: solid 1px black;
        }
        
        .RadEditor
        {
            filter: chroma(color=c2dcf0);
        }
        
        .reWrapper_corner,
        .reWrapper_center
        {
            display: none !important; /* for FF */            
        }
        
        td.reWrapper_corner,
        td.reWrapper_center
        {
            display: block\9 !important; /* for all versions of IE */            
        }
        
        </style>
    </head>
    <body class="BODY">
        <form id="form1" runat="server">
                             
            <qsf:header id="Header1" runat="server" navigationlanguage="c#"/>
         <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
         <asp:UpdatePanel id="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <table>
                        <tr>
                            <td colspan="2"><b>Registration Form</b></td>
                        </tr>
                        <tr>
                            <td style="white-space:nowrap;">First Name:</td>
                            <td style="padding-left:3px;"><asp:TextBox id="FirstBox" runat="server" CssClass="formInput"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="white-space:nowrap;">Last Name:</td>
                            <td style="padding-left:3px;"><asp:TextBox id="LastBox" runat="server" CssClass="formInput"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="white-space:nowrap;">Occupation:</td>
                            <td style="padding-left:3px;"><asp:TextBox id="Occupation" runat="server" CssClass="formInput"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="white-space:nowrap;">Resume:</td>
                            <td colspan="2">
                                     <telerik:RadEditor Height="150px" Width="300px" ToolsWidth="330px"
             EditModes="Design" ID="RadEditor1"     runat="server" ToolbarMode="ShowOnFocus"
             ToolsFile="~/Editor/Examples/EditorAsTextBox/BasicTools.xml">
             </telerik:RadEditor>
             <div style="margin-top: 4px;">Click in the content area to show the toolbar.</div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <table cellpadding="1" cellspacing="0" width="100%">
                                    <tr>
                                        <td align="center">
                                            <asp:button Runat="server" ID="Submit" Text="Submit" Width="80px" CssClass="button"></asp:button>&nbsp;&nbsp;&nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
         </ContentTemplate>
         </asp:UpdatePanel>
        
         <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