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

[Solved] No Word Wrap - truncate content

5 Answers 452 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 28 Apr 2008, 11:56 AM
Hi,

I have a comment field in a grid which could be very lengthy.  I want to add a tooltip to the grid which shows the full content, but I want to truncate whats visible in the cell itself.  i.e. I want to fix the width of the column, and prevent word wrap.  People can hover over the cell to see the full text.

This question is linked to the word-wrap and column width fixing rather than to the tooltip question (thats a separate thread!).

Thanks in advance

Stephen

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2008, 12:14 PM
ghini
Top achievements
Rank 2
commented on 31 Oct 2022, 05:34 PM

links not works
0
Stephen
Top achievements
Rank 1
answered on 28 Apr 2008, 01:28 PM
Hi Shinu,

It doesnt matter what I try I cant get this to work.  I have set ClientSettings to allow resize and ClipCellContent on Resize

<

ClientSettings EnableClientKeyValues="True">

<Resizing AllowColumnResize="True"

AllowRowResize = "false"

ResizeGridOnColumnResize = "false"

ClipCellContentOnResize = "true"

EnableRealTimeResize = "true" />

</ClientSettings>

And no matter what combination of ItemStyle I try for the column, it doesnt work.

<rad:GridBoundColumn DataField="COMMENTARY" UniqueName="COMMENTARY" HeaderText="Commentary">

<ItemStyle Wrap="False" Width="100px"/>

</rad:GridBoundColumn>

I thought fixing the width and turning off WordWrap would do the trick, but all that happens now is now matter how I resize, the text remains wrapped, but stays fixed at 100 pixels.

Thanks in advance

0
Stephen
Top achievements
Rank 1
answered on 28 Apr 2008, 01:28 PM
Hi Shinu,

It doesnt matter what I try I cant get this to work.  I have set ClientSettings to allow resize and ClipCellContent on Resize

<

ClientSettings EnableClientKeyValues="True">

<Resizing AllowColumnResize="True"

AllowRowResize = "false"

ResizeGridOnColumnResize = "false"

ClipCellContentOnResize = "true"

EnableRealTimeResize = "true" />

</ClientSettings>

And no matter what combination of ItemStyle I try for the column, it doesnt work.

<rad:GridBoundColumn DataField="COMMENTARY" UniqueName="COMMENTARY" HeaderText="Commentary">

<ItemStyle Wrap="False" Width="100px"/>

</rad:GridBoundColumn>

I thought fixing the width and turning off WordWrap would do the trick, but all that happens now is now matter how I resize, the text remains wrapped, but stays fixed at 100 pixels.

Thanks in advance

0
Stephen
Top achievements
Rank 1
answered on 28 Apr 2008, 05:39 PM

Hi,

As an update, I have given up trying and instead truncate by code during itemdatabound

If (TypeOf e.Item Is GridDataItem) Then

Dim gridItem As GridDataItem = CType(e.Item, GridDataItem)

For Each column As GridColumn In CType(sender, RadGrid).MasterTableView.RenderColumns

If (TypeOf column Is GridBoundColumn) Then

'this line will show a tooltip based on the Comment and Outcome field

If column.UniqueName = "COMMENTARY" Then

gridItem(column.UniqueName).ToolTip = gridItem(

"COMMENTARY").Text

gridItem(

"COMMENTARY").Text = Left(gridItem("COMMENTARY").Text, 40) & "..."

ElseIf column.UniqueName = "OUTCOME" Then

gridItem(column.UniqueName).ToolTip = gridItem(

"OUTCOME").Text

gridItem(

"OUTCOME").Text = Left(gridItem("OUTCOME").Text, 40) & "..."

End If

End If

Next


End If
0
Dimo
Telerik team
answered on 29 Apr 2008, 12:16 PM
Hi Stephen,

An alternative way to achieve truncated text in RadGrid cells is provided here:

http://www.telerik.com/community/forums/thread/b311D-bddhge.aspx


Sincerely yours,
Dimo
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
ghini
Top achievements
Rank 2
commented on 31 Oct 2022, 05:34 PM

the link http://www.telerik.com/community/forums/thread/b311D-bddhge.aspx not works..

can  you provide a new link?

Rumen
Telerik team
commented on 03 Nov 2022, 08:31 AM | edited

Tags
Grid
Asked by
Stephen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Stephen
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or