Telerik ASP.NET RadTextBox Disabled/Empty styling

Telerik’s RadTextBox doesn’t show the EmptyMessage in italics when the control is both disabled and empty. If you rely on disabled fields to show placeholder-style hints, this creates a visual inconsistency. Here’s the simple workaround I use in production.

This is the result that we're looking for:

HTML:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test2.aspx.vb" Inherits="CRM.Test2" %>
<!DOCTYPE html>
<head runat="server">
    <title></title>
    <link href="/CSS/RadInput.css" rel="stylesheet" />
    <style type="text/css">
        body {
            font-family: "Segoe UI", Arial, Helvetica, sans-serif;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>   
        <telerik:RadTextBox runat="server" EmptyMessage="EmptyMsg" ID="RadTextBox0"></telerik:RadTextBox> enabled, empty    <br /><br />
        <telerik:RadTextBox runat="server" EmptyMessage="EmptyMsg" ID="RadTextBox1"></telerik:RadTextBox> enabled with text <br /><br />
        <telerik:RadTextBox runat="server" EmptyMessage="EmptyMsg" ID="RadTextBox2"></telerik:RadTextBox> disabled, empty   <br /><br />
        <telerik:RadTextBox runat="server" EmptyMessage="EmptyMsg" ID="RadTextBox3"></telerik:RadTextBox> disabled with text
    </form>
</body>
</html>

This is RadInput.css:

/*Styles the text box */
html body .RadInput_MetroTouch .riTextBox {
    border-color: #e0dfdf;
    color: #333 !important;
    background-color: #fff;
    font: 100 16px "Segoe UI",Arial,Helvetica,sans-serif
}
/* Style the disabled textbox itself */
.RadInput .riTextBox.riDisabled {
    background-color: #f0f0f0 !important;
    color: #333 !important;
    border-color: #ccc !important;
}
/* the Telerik disabled/empty text box does not display the empty message in italics, this style is manually applied in 'populate' */
.state-disabled-empty {
    font-style: italic !important;
    opacity: 0.5 !important;
}

 

The code behind to apply the needed style to the empty/disabled text box:
During Populate(), if a RadTextBox is both disabled and empty, we manually apply the state-disabled-empty CSS class. If it has text, or if it’s enabled, we remove the class.

Public Class Test2
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Populate
    End Sub
    Sub Populate()
        RadTextBox1.Text = "Has Text"
        RadTextBox3.Text = "Has Text"
        RadTextBox2.Enabled = False
        RadTextBox3.Enabled = False
        RadTextBox2.CssClass = "state-disabled-empty"
    End Sub
 
End Class

 

 

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences