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

Text Trimming

5 Answers 168 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 12 Oct 2010, 10:35 PM
Hello,

Is it possible to cause text to trim with (...) on a combo box for the visible text when the combobox is closed?

We're using the combo boxes where the text can be 100 characters in length.  When selecting the items from the combo box this is not a problem because it can wrap or we can do other things.

If we have test such as:"

A really long long long long description

Instead of being just trimmed we would like it to display

A really long lon...   

I know how to do this for silverlight or WPF.  Can we do something with asp.net Ajax controls?

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Oct 2010, 10:54 AM
Hello,


You can add ellipsis explicitly after checking the text length either from client side or server side handler. Attach the OnClientSelectedIndexChanged event and change the Text using set_text() method of combo client object (if not using AutoPostBack).
Client-Side Basics
OnClientSelectedIndexChanged


-Shinu.
0
Michael
Top achievements
Rank 1
answered on 13 Oct 2010, 07:35 PM
Thanks for the response.

This sounds like its on the right track.  Do we need to use fixed width fonts?  Or is there a more direct way to tell when the actual width of the text is too long?  If we only count the characters, not all widths will be the same.  
0
Yana
Telerik team
answered on 19 Oct 2010, 09:51 AM
Hello Michael,

I've attached a simple page to show you how to achieve text trimming according to this article, please download the file and give it a try.

Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Monsignor
Top achievements
Rank 2
answered on 28 Oct 2010, 04:39 AM
Hello Yana,

In your sample the combo shows "..." always, even if the text is very short.

Also, it doesn't work in IE7 compatibility mode.
0
Yana
Telerik team
answered on 28 Oct 2010, 02:51 PM
Hello Monsignor,

You are right, these are the limitations of this method. Currently there is no other way to trim the text (except counting the characters).

Best wishes,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Michael
Top achievements
Rank 1
Yana
Telerik team
Monsignor
Top achievements
Rank 2
Share this question
or