TextBox - Render Modes

Phone Contract





Render mode

Change Render Mode

Lightweight vs. Classic Rendering
Classic Lightweight
Markup Size
  • RadTextBox
  • RadMaskedTextBox
  • RadNumericTextBox
  • RadDateInput
  • 2.43 KB
  • 2.75 KB
  • 3.14 KB
  • 3.41 KB
  • 2.93 KB
  • 3.25 KB
  • 3.92 KB
  • 3.91 KB
CSS Size 7.29 KB 4.79 KB
Image Sprite 2.16 KB 0 KB*
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

This demo showcases the two different rendering modes of Telerik's ASP.NET Input control: Classic and Lightweight.

  • Classic rendering is the long-standing rendering mode of the control in which its layout is implemented using table elements.
  • Lightweight rendering leverages HTM5 and CSS3 to deliver semantic HTML to the browser, but the control may lose its rounded corners, gradients and shadows in non-modern browsers. With this rendering, some table elements in the control layout are replaced with generic elements, such as div and span.

There is also a Native render mode option inherited directly from RenderMode. As RadInput does not have a specific HTML element, the Native render mode will have the same effect as the Classic one.

The default render mode of the control is Classic and you have the option to either explicitly set it to Lightweight or leverage the Auto mode to have the control choose the best rendering based on the user's browser.

Note: In order to provide optimal experience for your end users, we recommend that you use only one type of render mode for a control on a given page. For example, if you have two instances of RadInput on the page, it will be best if both of them use the same render mode.

Note: The Material skin is available only for the modern Lightweight render mode. Change the skin or the mode to properly visualize the demonstrated control.

Note on the statistics::
The markup size is calculated automatically in the code-behind by rendering a simple RadCalendar instance on a blank page with the settings from its configurator panels.
* - The Lightweight RenderMode of RadInput uses WebFont instead of image sprites for its embedded icons which offers more benefits over the images.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page CodeFile="DefaultCS.aspx.cs" Language="c#" Inherits="Telerik.Web.Examples.Input.RenderMode.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!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">
    <title>Telerik ASP.NET Example</title>
    <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 id="Div1" class="demo-containers" runat="server">
        <div class="demo-container" runat="server">
            <asp:Panel ID="Panel1" runat="server">
                <h3>Phone Contract</h3>
                <telerik:RadTextBox RenderMode="Lightweight" ID="RadTextBox1" runat="server" Width="100%" LabelWidth="40%" Label="Your Name"></telerik:RadTextBox><br />
                <telerik:RadMaskedTextBox RenderMode="Lightweight" ID="RadMaskedTextBox1" Width="100%" LabelWidth="40%" runat="server" Mask="(###)-######" Label="Phone Number"></telerik:RadMaskedTextBox><br />
                <telerik:RadNumericTextBox RenderMode="Lightweight" ID="RadNumericTextBox1" runat="server" Width="100%" LabelWidth="40%" Label="Monthly Fee" MaxLength="2">
                    <NumberFormat DecimalDigits="2" />
                </telerik:RadNumericTextBox><br />
                <telerik:RadDateInput RenderMode="Lightweight" ID="RadDateInput1" runat="server" Width="100%" LabelWidth="40%" Label="Starting date"></telerik:RadDateInput><br />
                <asp:RequiredFieldValidator ID="PickerRequiredFieldValidator" runat="server" Display="Dynamic"
                    CssClass="validator" ControlToValidate="RadDateInput1"
                    ErrorMessage="Please, select a date!"></asp:RequiredFieldValidator>
            </asp:Panel>
        </div>
    </div>
    <qsf:ConfiguratorPanel Expanded="true" runat="server" ID="ConfiguratorPanel1" Title="Render mode">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn1" Title="Change Render Mode" runat="server" Size="Medium">

                    <ul class="fb-group">

                        <li>
                            <qsf:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
                                OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
                                <asp:ListItem Value="Lightweight" Text="Lightweight" Selected="True"></asp:ListItem>
                                <asp:ListItem Value="Classic" Text="Classic"></asp:ListItem>
                            </qsf:RadioButtonList></li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn2" Title="Lightweight vs. Classic Rendering" runat="server" Size="Wide">
                    <table class="table">
                        <thead>
                            <tr>
                                <th></th>
                                <th>Classic</th>
                                <th>Lightweight</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th><span>Markup Size</span>
                                    <ul class="removeDots">
                                        <li>RadTextBox</li>
                                        <li>RadMaskedTextBox</li>
                                        <li>RadNumericTextBox</li>
                                        <li>RadDateInput</li>
                                    </ul>
                                </th>
                                <td>
                                    <ul class="removeDots moveDown">
                                        <li>
                                            <asp:Label ID="ClassicSizeTextBox" runat="server"></asp:Label></li>
                                        <li>
                                            <asp:Label ID="ClassicSizeMaskedTextBox" runat="server"></asp:Label></li>
                                        <li>
                                            <asp:Label ID="ClassicSizeNumericTextBox" runat="server"></asp:Label></li>
                                        <li>
                                            <asp:Label ID="ClassicSizeDateInput" runat="server"></asp:Label></li>
                                    </ul>
                                </td>
                                <td>
                                    <ul class="removeDots moveDown">
                                        <li>
                                            <asp:Label ID="LightweightSizeTextBox" runat="server"></asp:Label></li>
                                        <li>
                                            <asp:Label ID="LightweightSizeMaskedTextBox" runat="server"></asp:Label></li>
                                        <li>
                                            <asp:Label ID="LightweightSizeNumericTextBox" runat="server"></asp:Label></li>
                                        <li>
                                            <asp:Label ID="LightweightSizeDateInput" runat="server"></asp:Label></li>
                                    </ul>
                                </td>
                            </tr>
                            <tr>
                                <th>CSS Size</th>
                                <td>7.29 KB</td>
                                <td>4.79 KB</td>
                            </tr>
                            <tr>
                                <th>Image Sprite</th>
                                <td>2.16 KB</td>
                                <td>0 KB*</td>
                            </tr>
                        </tbody>
                    </table>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?