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 / Table Properties CSS Class Layout tool

1. RadEditor with TableLayoutCssFile property set to TableLayoutCss.css.

   
  
 
 
   

2. RadEditor with default CSS Class Layout tool functionality.

   
  
 
 
   


  • The "CSS Class Layout" tool in the "Table Properties" dialog

    It is a common scenario to style a table with CSS classes for increased clarity and visual appeal. Manually setting class name to each individual cell and row is a slow and tedious task.

    The "CSS Class Layout" tool available in the "Table Properties" dialog makes the task real easy by allowing the user to style a new, or existing tables completely by choosing a table layout form a drop down (similar to visual studio design time). The "CSS Class Layout" tool contains a number of built in layouts. If a user chooses one, a style tag is inserted to the edited content.

    In addition to this developers can also specify their own style sheet files which fit better the layout of their applications. The external Style sheet can be edit by using the TableLayoutCssFile property of the RadEditor. In this case the editor will not insert a style tag in to its content area, so one would need to make sure that this external style sheet file is also imported in the page where the edited content will be displayed. In the custom css file can be inserted multiple table CSS layouts. Each layout consists of number of CSS style classes following certain naming conventions.

    For example, here is how a table layout should be constructed. There is one main class (myClass) that will be applied on the table. All other classes should contain the name of the main class plus a respective suffix (for example: myClassTableHeaderRow).

    These are the classes for a layout with main class myClass:

    Table class
    .myClass {}

    Table Header classes
    .myClassTable tr.myClassTableHeaderRow {}
    .myClassTable td.myClassTableHeaderFirstCol {}
    .myClassTable td.myClassTableHeaderLastCol {}
    .myClassTable td.myClassTableHeaderOddCol {}
    .myClassTable td.myClassTableHeaderEvenCol {}

    Table Body classes
    .myClassTable tr.myClassTableOddRow {}
    .myClassTable tr.myClassTableEvenRow {}
    .myClassTable td.myClassTableFirstCol {}
    .myClassTable td.myClassTableLastCol {}
    .myClassTable td.myClassTableOddCol {}
    .myClassTable td.myClassTableEvenCol {}

    Table Footer classes
    .myClassTable tr.myClassTableFooterRow {}
    .myClassTable td.myClassTableFooterFirstCol {}
    .myClassTable td.myClassTableFooterLastCol {}
    .myClassTable td.myClassTableFooterOddCol {}
    .myClassTable td.myClassTableFooterEvenCol {}

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Theme="Default" Language="C#" Debug="true" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Editor.TableLayoutCssFile.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">
            .codeListings
            {
                overflow: scroll !important;
            }
        </style>
    </head>
    <body class="BODY">
        <form id="form1" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
        <p style="clear: both; float: none; font-weight: bold; margin-top: 25px; margin-bottom: 10px;">
            1. RadEditor with TableLayoutCssFile property set to <a href="TableLayoutCss.css"
                title="TableLayoutCss.css">TableLayoutCss.css</a>.</p>
        <telerik:RadEditor ID="RadEditor1" Height="400" runat="server" TableLayoutCssFile="TableLayoutCss.css">
            <Content>
         <table class="purpletable" style="margin-top: 25px; width: 500px;">
                            <thead>
                                <tr class="purpletableTableHeaderRow">
                                    <th class="purpletableTableHeaderFirstCol">Browser/OS</th>
                                    <th class="purpletableTableHeaderOddCol">Windows</th>
                                    <th class="purpletableTableHeaderEvenCol">Mac OS</th>
                                    <th class="purpletableTableHeaderLastCol">Linux</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="purpletableTableOddRow">
                                    <td class="purpletableTableFirstCol" valign="top"><img alt="ie" src="../../Img/BrowserIcons/ie.gif" /> Internet Explorer</td>
                                    <td class="purpletableTableOddCol" valign="top">6.0+</td>
                                    <td class="purpletableTableEvenCol" valign="top">- </td>
                                    <td class="purpletableTableLastCol" valign="top">- </td>
                                </tr>
                                <tr class="purpletableTableEvenRow">
                                    <td class="purpletableTableFirstCol"><img alt="ff" src="../../Img/BrowserIcons/ff.gif" /> Firefox</td>
                                    <td class="purpletableTableOddCol">1.5+</td>
                                    <td class="purpletableTableEvenCol">1.5+</td>
                                    <td class="purpletableTableLastCol">1.5+</td>
                                </tr>
                                <tr class="purpletableTableOddRow">
                                    <td class="purpletableTableFirstCol"><img alt="chrome" src="../../Img/BrowserIcons/chrome.gif" /> Google Chrome</td>
                                    <td class="purpletableTableOddCol">0.2+</td>
                                    <td class="purpletableTableEvenCol">5.0+</td>
                                    <td class="purpletableTableLastCol">5.0+</td>
                                </tr>
                                <tr class="purpletableTableEvenRow">
                                    <td class="purpletableTableFirstCol"><img alt="opera" src="../../Img/BrowserIcons/opera.gif" /> Opera</td>
                                    <td class="purpletableTableOddCol">9.0+</td>
                                    <td class="purpletableTableEvenCol">9.0+</td>
                                    <td class="purpletableTableLastCol">-</td>
                                </tr>
                                <tr class="purpletableTableOddRow">
                                    <td class="purpletableTableFirstCol"><img alt="safari" src="../../Img/BrowserIcons/safari.gif" /> Safari</td>
                                    <td class="purpletableTableOddCol">3.0+</td>
                                    <td class="purpletableTableEvenCol">3.0+</td>
                                    <td class="purpletableTableLastCol">-</td>
                                </tr>
                                <tr class="purpletableTableFooterRow">
                                    <td class="purpletableTableFooterFirstCol"><img alt="chrome" src="../../Img/BrowserIcons/netscape.gif" /> Netscape</td>
                                    <td class="purpletableTableFooterOddCol">9.0+</td>
                                    <td class="purpletableTableFooterEvenCol">9.0+</td>
                                    <td class="purpletableTableFooterLastCol">9.0+</td>
                                </tr>
                            </tbody>
                        </table>
            </Content>
        </telerik:RadEditor>
        <p style="clear: both; float: none; font-weight: bold; margin-top: 25px; margin-bottom: 10px;">
            2. RadEditor with default CSS Class Layout tool functionality.</p>
        <telerik:RadEditor ID="RadEditor2" Height="400" runat="server">
            <Content>
         <table class="telerik-reTable-1" style="margin-top: 25px; width: 500px;">
                        <thead>
                            <tr class="telerik-reTableHeaderRow-1">
                                <th class="telerik-reTableHeaderFirstCol-1">Browser/OS</th>
                                <th class="telerik-reTableHeaderOddCol-1">Windows</th>
                                <th class="telerik-reTableHeaderEvenCol-1">Mac OS</th>
                                <th class="telerik-reTableHeaderLastCol-1">Linux</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr class="telerik-reTableOddRow-1">
                                <td class="telerik-reTableFirstCol-1" valign="top"><img alt="ie" src="../../Img/BrowserIcons/ie.gif" /> Internet Explorer</td>
                                <td class="telerik-reTableOddCol-1" valign="top">6.0+</td>
                                <td class="telerik-reTableEvenCol-1" valign="top">- </td>
                                <td class="telerik-reTableLastCol-1" valign="top">- </td>
                            </tr>
                            <tr class="telerik-reTableEvenRow-1">
                                <td class="telerik-reTableFirstCol-1"><img alt="ff" src="../../Img/BrowserIcons/ff.gif" /> Firefox</td>
                                <td class="telerik-reTableOddCol-1">1.5+</td>
                                <td class="telerik-reTableEvenCol-1">1.5+</td>
                                <td class="telerik-reTableLastCol-1">1.5+</td>
                            </tr>
                            <tr class="telerik-reTableOddRow-1">
                                <td class="telerik-reTableFirstCol-1"><img alt="chrome" src="../../Img/BrowserIcons/chrome.gif" /> Google Chrome</td>
                                <td class="telerik-reTableOddCol-1">0.2+</td>
                                <td class="telerik-reTableEvenCol-1">5.0+</td>
                                <td class="telerik-reTableLastCol-1">5.0+</td>
                            </tr>
                            <tr class="telerik-reTableEvenRow-1">
                                <td class="telerik-reTableFirstCol-1"><img alt="opera" src="../../Img/BrowserIcons/opera.gif" /> Opera</td>
                                <td class="telerik-reTableOddCol-1">9.0+</td>
                                <td class="telerik-reTableEvenCol-1">9.0+</td>
                                <td class="telerik-reTableLastCol-1">-</td>
                            </tr>
                            <tr class="telerik-reTableOddRow-1">
                                <td class="telerik-reTableFirstCol-1"><img alt="safari" src="../../Img/BrowserIcons/safari.gif" /> Safari</td>
                                <td class="telerik-reTableOddCol-1">3.0+</td>
                                <td class="telerik-reTableEvenCol-1">3.0+</td>
                                <td class="telerik-reTableLastCol-1">-</td>
                            </tr>
                            <tr class="telerik-reTableFooterRow-1">
                                <td class="telerik-reTableFooterFirstCol-1"><img alt="chrome" src="../../Img/BrowserIcons/netscape.gif" /> Netscape</td>
                                <td class="telerik-reTableFooterOddCol-1">9.0+</td>
                                <td class="telerik-reTableFooterEvenCol-1">9.0+</td>
                                <td class="telerik-reTableFooterLastCol-1">9.0+</td>
                            </tr>
                        </tbody>
                    </table>
                    <style id="telerik-reTable-1" type="text/css">
                        .telerik-reTable-1
                        {
                            border-bottom: 0px;
                            border-left: 0px;
                            border-collapse: collapse;
                            font-family: Tahoma;
                            border-top: 0px;
                            border-right: 0px;
                        }
                        .telerik-reTable-1 TR.telerik-reTableHeaderRow-1
                        {
                            text-align: left;
                            padding-bottom: 10px;
                            line-height: 14pt;
                            text-transform: capitalize;
                            font-style: normal;
                            margin: 10px;
                            padding-left: 10px;
                            border-spacing: 10px;
                            padding-right: 10px;
                            font-family: Tahoma;
                            background: #d6e8ff;
                            color: #3f4d6b;
                            font-size: 10pt;
                            vertical-align: top;
                            font-weight: bold;
                            padding-top: 10px;
                        }
                        .telerik-reTable-1 TD.telerik-reTableHeaderFirstCol-1
                        {
                            padding-bottom: 0in;
                            line-height: 14pt;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            color: #3a4663;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableHeaderLastCol-1
                        {
                            padding-bottom: 0in;
                            line-height: 14pt;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            color: #3a4663;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableHeaderOddCol-1
                        {
                            padding-bottom: 0in;
                            line-height: 14pt;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            color: #3a4663;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableHeaderEvenCol-1
                        {
                            padding-bottom: 0in;
                            line-height: 14pt;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            color: #3a4663;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TR.telerik-reTableOddRow-1
                        {
                            background-color: #f2f3f4;
                            color: #666666;
                            font-size: 10pt;
                            vertical-align: top;
                        }
                        .telerik-reTable-1 TR.telerik-reTableEvenRow-1
                        {
                            background-color: #e7ebf7;
                            color: #666666;
                            font-size: 10pt;
                            vertical-align: top;
                        }
                        .telerik-reTable-1 TD.telerik-reTableFirstCol-1
                        {
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableLastCol-1
                        {
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableOddCol-1
                        {
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableEvenCol-1
                        {
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TR.telerik-reTableFooterRow-1
                        {
                            line-height: 11pt;
                            background-color: #d6e8ff;
                            font-family: Tahoma;
                            color: #4a5a80;
                            font-size: 10pt;
                            font-weight: 500;
                        }
                        .telerik-reTable-1 TD.telerik-reTableFooterFirstCol-1
                        {
                            text-align: left;
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            border-top: gray 1pt solid;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableFooterLastCol-1
                        {
                            text-align: left;
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            border-top: gray 1pt solid;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableFooterOddCol-1
                        {
                            text-align: left;
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            border-top: gray 1pt solid;
                            padding-top: 0in;
                        }
                        .telerik-reTable-1 TD.telerik-reTableFooterEvenCol-1
                        {
                            text-align: left;
                            padding-bottom: 0in;
                            padding-left: 5.4pt;
                            padding-right: 5.4pt;
                            border-top: gray 1pt solid;
                            padding-top: 0in;
                        }
                    </style>
            </Content>
        </telerik:RadEditor>
        <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