RadListBox - Set width dynamically depending on Text of Item

2 posts, 0 answers
  1. Paresh
    Paresh avatar
    2 posts
    Member since:
    Feb 2012

    Posted 29 Feb 2012 Link to this post


    By default every item text gets wrapped if its longer than width of RadListBox.
    How to set width of RadListBox dynamically based on text of item. Basically I want to expand width of RadListBox, without wrapping text of item.
    In below example, 3rd item gets wrapped automatically. I want to expand RadListBox in a way that it can fully accommodate 3rd item without wrapping or scroll bar.
            runat="server" ID="RadListBoxSource"
                <telerik:RadListBoxItem Text="China" Value="1"/>
                <telerik:RadListBoxItem Text="Egypt" Value="1"/>
                <telerik:RadListBoxItem Text="England England England England England England England England England" Value="1"/>
                <telerik:RadListBoxItem Text="France" Value="1"/>

    Appreciate any help.

  2. Bozhidar
    Bozhidar avatar
    1096 posts

    Posted 01 Mar 2012 Link to this post

    Hi Paresh,

    You can do that simply by adding the following CSS:
        width:auto !important;

    If you use some skin, change the selector, so that instead of Default it says the skin name. For instance, if you use the Forest skin, it should look like:
        width:auto !important;
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top