Using the CSS class to set the RadInput width, when followed by other controls

4 posts, 0 answers
  1. Michel
    Michel avatar
    9 posts
    Member since:
    Jun 2012

    Posted 30 Nov 2009 Link to this post

    I tried following the instructions here http://www.telerik.com/help/aspnet-ajax/input_appearancewidth.html (Using the CSS class to set the width). However, when ShowButton = true, ShowSpinButtons = true or Label = true, controls that are immediatly after the RadInput seem to remain aligned with the default 125px and not the value specified by the CSS.

    Below is such an example, where a RadNumericTextBox has both a label and spin buttons, and is followed by a RequiredFieldValidator.

    <html xmlns="http://www.w3.org/1999/xhtml">  
        <head id="Head1" runat="server">  
            <title></title>  
            <style type="text/css">  
                /*when using label or buttons*/  
                .RadInput_Default,  
                .RadInput_Default table  
                {  
                    width: 250px !important;  
                }  
                /*else*/  
                .RadInput_Default .riTextBox  
                {  
                    width: 250px  !important ;  
                }  
            </style> 
        </head> 
        <body> 
            <form id="form1" runat="server">  
                <asp:ScriptManager ID="ScriptManager1" runat="server" />    
                <tlk:RadNumericTextBox id="RadNumericTextBox1" runat="server" Label="Test Label: " ShowSpinButtons="true" /> 
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadNumericTextBox1" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator> 
                <br /> 
                <asp:Button ID="Button1" runat="server" Text="Button" /> 
            </form> 
        </body>   
    </html> 

    Any help to solve this issue would be appreciated.

  2. Dimo
    Admin
    Dimo avatar
    8486 posts

    Posted 30 Nov 2009 Link to this post

    Hi Michel,

    You should not use the two CSS rules at the same time, as suggested by the CSS comments. Please remove the second one.

    Kind regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Michel
    Michel avatar
    9 posts
    Member since:
    Jun 2012

    Posted 30 Nov 2009 Link to this post

    Thanks for the quick response.

    It wasn't that clear from the comments that we need to use only one of the two. (I though the comments were simply indicating the case where each entry had an effect.)

    If I have RadInputs with label or buttons and others without, I guess that I will create two different class selectors for each senario.

    Michel
  4. Dimo
    Admin
    Dimo avatar
    8486 posts

    Posted 30 Nov 2009 Link to this post

    Hello Michel,

    Yes, you will need different selectors, for example you can use CSS classes of other elements on the page, which wrap the two types of textboxes.

    Kind regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top