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

change dropdownwitdth at client

6 Answers 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
a.bek
Top achievements
Rank 1
a.bek asked on 28 Aug 2008, 10:48 AM
Hi can someone please tell how can i do what the subject says

thnks

6 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 28 Aug 2008, 11:22 AM
Hi a.bek,

Please find below a sample code snippet that shows the needed approach.

<form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
 
    <script language="javascript" type="text/javascript">  
    function OnClientDropDownOpening(sender, eventArgs)  
    {  
        if(sender.get_items().get_count() != 0)  
        {  
            sender._dropDownWidth = "400";  
        }  
    }  
    </script> 
 
    <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientDropDownOpening="OnClientDropDownOpening">  
        <Items> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" /> 
            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" /> 
        </Items> 
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
    </telerik:RadComboBox> 
</form> 


Kind regards,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
a.bek
Top achievements
Rank 1
answered on 28 Aug 2008, 01:18 PM
Hi Paul

thnks for the code i need something more

suppose i have a grid inside the combo and i need to set the dropdownwidth so no horizontal scrollbars to be visible

please provide some sample code


0
Paul
Telerik team
answered on 29 Aug 2008, 08:29 AM
Hi a.bek,

If your grid has fixed width you can achieve your goal using the provide code snippet.

<script language="javascript" type="text/javascript">     
    function OnClientDropDownOpening(sender, eventArgs)     
    {     
        if(sender.get_items().get_count() != 0)     
        {     
            sender._dropDownWidth = "400" + "16";  
        }     
    }     
    </script>   
 


Regards,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
a.bek
Top achievements
Rank 1
answered on 29 Aug 2008, 08:34 AM
Hi Paul

the problem is that the grid does not have fixed width it uses the default one and i do not know how is calculated/obtained on the client side
0
Sebastian
Telerik team
answered on 29 Aug 2008, 01:33 PM
Hi a.bek,

Unfortunately without setting explicitly fixed width for the grid which resides in the combobox dropdown, you are not able to determine what size to set for the combobox popup container.

You should either use the approach described below in this thread or expand the RadComboBox dropdown width to 100% to ensure that the embedded grid will fit in it. I hope that one of these options is feasible for your particular case.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Gary
Top achievements
Rank 1
answered on 05 Mar 2009, 06:13 PM
I am using version 2.1.1 of the RadCombo (not ajax).  is there a way of changing the width in 1.1?

Thanks,
Gary
Tags
ComboBox
Asked by
a.bek
Top achievements
Rank 1
Answers by
Paul
Telerik team
a.bek
Top achievements
Rank 1
Sebastian
Telerik team
Gary
Top achievements
Rank 1
Share this question
or