This is a migrated thread and some comments may be shown as answers.

Removing CSS classes for controls

3 Answers 535 Views
Input
This is a migrated thread and some comments may be shown as answers.
Lambros
Top achievements
Rank 1
Lambros asked on 06 Apr 2009, 10:29 AM
Hi

I'm using RadTextBox and in result html I see that it already contains some classes like "riTextBox riEnabled"
Is it possible to remove them? And how?

Thanks

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 06 Apr 2009, 11:52 AM
Hello Lambros,

Currently you can remove the RadTextBox CSS classes at runtime, as demonstrated below. In future versions, the CSS classes will not appear if you set an empty skin for the control ( Skin="" ).

<%@ Page Language="C#" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<script runat="server"
 
    protected void Page_PreRenderComplete(object sender, EventArgs e) 
    { 
        RadTextBox1.EnabledStyle.CssClass = String.Empty; 
        RadTextBox1.HoveredStyle.CssClass = String.Empty; 
        RadTextBox1.FocusedStyle.CssClass = String.Empty; 
    } 
 
</script> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>RadControls for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server"
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
<telerik:RadTextBox ID="RadTextBox1" runat="server" /> 
 
</form> 
</body> 
</html> 


All the best,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Lambros
Top achievements
Rank 1
answered on 06 Apr 2009, 02:53 PM
I'm sorry, but I guess it is not acceptable for me, because I use RadTextBox  in a wrapper control.
So from the control I have no access to page event PreRenderComplete
And in PreRender  these properties aren't assigned.
Any other ideas?
0
Dimo
Telerik team
answered on 06 Apr 2009, 03:26 PM
Hello Lambros,

In this case, another option is to remove the CSS classes on the client:

<%@ Page Language="C#" %>  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
<meta http-equiv="content-type" content="text/html; charset=utf-8" />  
<title>RadControls for ASP.NET AJAX</title>  
</head>  
<body>  
<form id="form1" runat="server">  
<asp:ScriptManager ID="ScriptManager1" runat="server" />  
  
<telerik:RadTextBox ID="RadTextBox1" runat="server"
    <ClientEvents OnLoad="TextBoxLoad" /> 
</telerik:RadTextBox> 
  
<script type="text/javascript"
 
function TextBoxLoad(sender, args) 
    sender._textBoxElement.className = ""
    sender.get_styles().EnabledStyle[1] = ""; 
    sender.get_styles().HoveredStyle[1] = ""; 
    sender.get_styles().FocusedStyle[1] = ""; 
 
</script> 
 
</form>  
</body>  
</html> 


Sincerely yours,
Dimo
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Input
Asked by
Lambros
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Lambros
Top achievements
Rank 1
Share this question
or