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

[Solved] Wrapping long items in RadComboBox

3 Answers 288 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rohit Dehar
Top achievements
Rank 1
Rohit Dehar asked on 04 Dec 2009, 12:08 AM
Hi:

What is the best way to wrap long items in a RadComboBox, such that:

1. An ellipsis is displayed for long names;
2. The items do not wrap and span more than 1 line;
3. On hovering on item, full text is displayed as tooltip;

I read that there is a "TextClipper" that can be used for this purpose, but I did not find any examples.

Any help will be appreciated.

Thanks .. Rohit Dehar

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Dec 2009, 10:27 AM
Hi Rohit Dehar,

Here is the code that I tried to achieve the functionality.
CS:
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        foreach (RadComboBoxItem item in RadComboBox3.Items) 
        { 
            if (item.Text.Length > 17)  // Check with the required length, like 17 here 
            { 
                item.ToolTip = item.Text.ToString(); 
                item.Text = (item.Text).Substring(0,17) + "..."
            } 
        } 
    } 

-Shinu.
0
Rohit Dehar
Top achievements
Rank 1
answered on 04 Dec 2009, 05:41 PM
Hi Shinu,

Thanks for your reply, though this is not what I was asking for, I have implemented similar solution on DataBind/ItemCreated events.

My specific question was if there is an in-built mechanism like TextClipper that will solve long items, wrapping and hover.
0
Accepted
Yana
Telerik team
answered on 09 Dec 2009, 08:26 AM
Hello Rohit,

Unfortunately RadComboBox doesn't have any built-in mechanism for wrapping items like this.

Regards,
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
Rohit Dehar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rohit Dehar
Top achievements
Rank 1
Yana
Telerik team
Share this question
or