truncate the extra text in column and append "..." to truncated string

3 posts, 0 answers
  1. prayag ganoje
    prayag ganoje avatar
    127 posts
    Member since:
    Feb 2010

    Posted 27 Apr 2011 Link to this post


    I am do have data extending the column width. But I want to row without data wrap and truncated row should displayed with "..." extension. I do have a dataset as a datasource for the grid. Is it possible with some string format to achieve this ? Or can you suggest some better method to do this ?

  2. Princy
    Princy avatar
    16662 posts
    Member since:
    Mar 2007

    Posted 28 Apr 2011 Link to this post

    Hello Prayag,

    In order to achieve this, check for the Length of the cell text and then set ToolTip. Try the following snippet code by attaching ItemDataBound event to your RadGrid. Hope this helps you.


    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
       if (e.Item is GridDataItem)
      GridDataItem item = (GridDataItem)e.Item;
      if (item["ColumnUniqueName"].Text.Length > 4)
       item["ColumnUniqueName"].ToolTip = item["ColumnUniqueName"].Text.ToString(); // Set the Tooltip
       item["ColumnUniqueName"].Text = (item["ColumnUniqueName"].Text).Substring(0, 5) + "...";


  3. Derek
    Derek avatar
    99 posts
    Member since:
    Oct 2008

    Posted 25 Sep 2011 Link to this post

    Any code examples for how to accomplish this when using a column containing HTML? There is a column containing RadEditor content, so it's not as simple as just truncating the content since the content contains html content as well as actual text.

Back to Top