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

[Solved] RadCombobox Relative Width

1 Answer 142 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ashwin Deshpande
Top achievements
Rank 1
Ashwin Deshpande asked on 27 Sep 2009, 03:48 PM
Hi,

How can i set Relative Width for RadCombobox  like 50%  intead of 250 px or so......

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 28 Sep 2009, 08:24 AM
Hi Ashwin,

You cannot set relative height of RadComboBox, this can be achieved only using javascript to calculate the needed height like this:

<div style="border: 1px solid red; height: 130px"
    <telerik:RadComboBox ID="ddlDestination" runat="server" 
        OnClientDropDownOpened="dropDownOpened"
        <items> 
            <telerik:RadComboBoxItem Text="item 1" /> 
            <telerik:RadComboBoxItem Text="item 2" /> 
            <telerik:RadComboBoxItem Text="item 3" /> 
            <telerik:RadComboBoxItem Text="item 4" /> 
            <telerik:RadComboBoxItem Text="item 5" /> 
            <telerik:RadComboBoxItem Text="item 6" /> 
        </items> 
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
    </telerik:RadComboBox> 
</div> 

and dropDownOpened function:

<script type="text/javascript"
    function dropDownOpened(sender, args) { 
 
        var comboNeededHeight = sender.get_element().parentNode.clientHeight / 2; 
        var dropDownNeededHeight = comboNeededHeight - sender.get_element().clientHeight; 
        sender._animationContainer.style.height = dropDownNeededHeight + "px"
        sender.get_childListElementWrapper().style.height = dropDownNeededHeight + "px"
    } 
</script> 


Best wishes,
Yana
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.
Tags
ComboBox
Asked by
Ashwin Deshpande
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or