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

[Solved] Alligning Text to left after selection

2 Answers 115 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vijay
Top achievements
Rank 1
Vijay asked on 28 May 2009, 03:20 PM
Hi,

I am using RadCombo box and when I select a item from the dropdown list, the selected item appears such that it shows the text at the rightside immediate visible.I have to scroll the cursor to the left to see the start of the selected text.This happens because the width of the combox box is not enough to show the the whole selected text.

For example if the selected text is "United States of Soviet Socialist Republic" then it shows "Soviet Socialist Republic" after selection.
After that I have to scroll the cursor to teh left to see the rest.

What I want is after immediate selection , I would like to display   "United States of Soviet Socialist" instead of  "Soviet Socialist Republic".

Please update me asap.

Thanks
Vijay

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 May 2009, 08:11 AM
Hi Vijay,

Try the following client side code and see whether it is working as you expected.

ASPX:
 
<telerik:RadComboBox ID="RadComboBox2" OnClientSelectedIndexChanged="ClientSelectedIndexChanged" runat="server" AutoPostBack="False"  AllowCustomText="True">  
    <Items> 
        <telerik:RadComboBoxItem runat="server" Text="United States of Soviet Socialist Republic" Value="RadComboBoxItem1" /> 
        <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" />         
    </Items> 
</telerik:RadComboBox> 

JavaScript:
 
<script type="text/javascript">  
function ClientSelectedIndexChanged(sender, eventArgs)  
{  
    var comboBox = $find("<%=RadComboBox2.ClientID %>");  
    var input = comboBox.get_inputDomElement();           
    if (input != null && input.value.length > 0)    
    {  
        if (input.createTextRange)  
        {  
            var FieldRange = input.createTextRange();    
            FieldRange.moveStart('character', 0);    
            FieldRange.collapse();    
            FieldRange.select();    
        }  
    }  
}  
</script> 

Thanks,
Princy.
0
Saumin
Top achievements
Rank 2
answered on 05 Jun 2009, 09:29 PM
Hi,
This works great in IE. But doesnt work at all in Firefox. Any ideas?

Thanks!
Tags
ComboBox
Asked by
Vijay
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Saumin
Top achievements
Rank 2
Share this question
or