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

Grid has autoellipsis function ?

3 Answers 178 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yo
Top achievements
Rank 1
Yo asked on 03 Jan 2014, 08:14 AM
Hi,
    Is the grid support autoellipsis function ?
Thank you for your answer.

Don.,

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Jan 2014, 09:27 AM
Hi ,

I'm not clear about your requirement, if you want to set ellipsis for some column, please try the following code snippet.
If this doesn't help please elaborate on your requirement.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        if (item["ColumnUniqueName"].Text.Length > 4)
        {             
            item["ColumnUniqueName"].Text = (item["ColumnUniqueName"].Text).Substring(0, 5) + "...";
        }
    }
}

Thanks,
Princy
0
Yo
Top achievements
Rank 1
answered on 07 Jan 2014, 07:05 AM
Hi, 
    Thank you your answer, I just wondering the grid have any function that can do the autoellipsis automatically. 
e.g. When i try re-size the colume width, The data will automatically transform to "...." if the width is shorter than the column.

Thank you very much .
0
Princy
Top achievements
Rank 2
answered on 07 Jan 2014, 07:46 AM
Hi ,

As far as i know there is no automatic approach to obtain this feature from RadGrid. You can try setting the following CSS to obtain ellipsis:

CSS:
<style type="text/css">
  .RadGrid td
  {
    white-space: nowrap;
    text-overflow: ellipsis;
  }
</style>

Thanks,
Princy
Tags
Grid
Asked by
Yo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Yo
Top achievements
Rank 1
Share this question
or