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

HOw to wrap the text without space in a Rad Grid column

2 Answers 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sudha
Top achievements
Rank 1
Sudha asked on 12 Aug 2011, 07:29 AM
Hi,

Am using a RadGrid in my application. When I enter data  without any space in between(ex: HI_How_Are_You_?) in one of the columns, the data does not wrap. Kindly help me in fixing this issue as early as possible.

Thanks,
Sudha.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Aug 2011, 08:26 AM
Hello Sudha,

Try the following code snippet to wrap the text without space.
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"].ToolTip = item["City"].Text.ToString(); 
            item["ColumnUniqueName"].Text = (item["ColumnUniqueName"].Text).Substring(0, 5) + "...";
          }
      }
 }

Thanks,
Princy.
0
Sebastian
Telerik team
answered on 12 Aug 2011, 08:35 AM
Hello Sudha,

Texts can be wrapped in the grid columns when the string values are separated with space(s) - you can verify that with the standard MS GridView control as well. Therefore, you should consider either entering spaces (if possible) or enable column resizing and clip the cell content on resize as illustrated in this live demo.

Best regards,
Sebastian
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Sudha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or