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
Check out the links below ona similar discussion:
http://www.telerik.com/community/forums/thread/b311D-bddkbt.aspx
http://www.telerik.com/community/forums/thread/b311D-bbeecb.aspx
Thanks,
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
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
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
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
the link http://www.telerik.com/community/forums/thread/b311D-bddhge.aspx not works..
can you provide a new link?
Hi Fabrizio,
I am afraid we cannot provide the correct urls since those are pretty old from 2008 and there aren't redirects or human-read titles but GUID in URL to help us with the investigation. Nevertheless, you can use Google or the search of the Telerik forums to locate all discussions on the topic:
- https://www.google.com/search?q=truncated+text+in+RadGrid+cells&rlz=1C1GCEA_enBG1029BG1029&sourceid=chrome&ie=UTF-8
- https://www.telerik.com/forums/aspnet-ajax?searchText=truncated%20text%20in%20RadGrid%20cells
- https://www.telerik.com/forums/truncate-the-extra-text-in-column-and-append-to-truncated-string
- https://www.telerik.com/forums/truncate-column-text-not-working
- https://www.telerik.com/forums/truncate-the-extra-text-in-column-and-append-to-truncated-string
- https://stackoverflow.com/questions/2094510/truncate-text-in-radgrid-column
