Removing CSS classes for controls

4 posts, 0 answers
  1. Lambros
    Lambros avatar
    11 posts
    Member since:
    Oct 2007

    Posted 06 Apr 2009 Link to this post

    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
  2. Dimo
    Admin
    Dimo avatar
    8452 posts

    Posted 06 Apr 2009 Link to this post

    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.
  3. Lambros
    Lambros avatar
    11 posts
    Member since:
    Oct 2007

    Posted 06 Apr 2009 Link to this post

    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?
  4. Dimo
    Admin
    Dimo avatar
    8452 posts

    Posted 06 Apr 2009 Link to this post

    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.
Back to Top