Text Trimming

6 posts, 0 answers
  1. Michael
    Michael avatar
    17 posts
    Member since:
    Aug 2010

    Posted 12 Oct 2010 Link to this post

    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?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Oct 2010 Link to this post

    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.
  3. Michael
    Michael avatar
    17 posts
    Member since:
    Aug 2010

    Posted 13 Oct 2010 Link to this post

    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.  
  4. Yana
    Admin
    Yana avatar
    4916 posts

    Posted 19 Oct 2010 Link to this post

    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
  5. Monsignor
    Monsignor avatar
    13 posts
    Member since:
    Dec 2008

    Posted 27 Oct 2010 Link to this post

    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.
  6. Yana
    Admin
    Yana avatar
    4916 posts

    Posted 28 Oct 2010 Link to this post

    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
Back to Top