Ahrensberg
Top achievements
Rank 1
Ahrensberg
asked on 23 Sep 2009, 08:04 AM
Hi all,
I have a RadGrid posted with data by use of GridBoundColumns. These columns/cells is given a fixed width and itemstyle-wrap set to false. This cause that full text in some cells isn't shown fully, and therefore I want to have a tooltip at each cell, showing the full content. I don't have the tooltip possibility at the GridBoundColumn, and cannot figure out how to do it afterwards by either OnItemCreated or OnDataBound?!
Can anyone tell me how to do?! :o)
I have a RadGrid posted with data by use of GridBoundColumns. These columns/cells is given a fixed width and itemstyle-wrap set to false. This cause that full text in some cells isn't shown fully, and therefore I want to have a tooltip at each cell, showing the full content. I don't have the tooltip possibility at the GridBoundColumn, and cannot figure out how to do it afterwards by either OnItemCreated or OnDataBound?!
Can anyone tell me how to do?! :o)
6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 23 Sep 2009, 11:20 AM
Hello Ahrensberg,
You can refer to the following help document to show a tooltip when an item is hovered.
Adding tooltips for grid items
Thanks
Princy.
You can refer to the following help document to show a tooltip when an item is hovered.
Adding tooltips for grid items
Thanks
Princy.
0
Ahrensberg
Top achievements
Rank 1
answered on 23 Sep 2009, 11:46 AM
I have tried to use this example but can't figure out how to refere to the content of the cell. gridItem[column.UniqueName].Text is equal to emptyspace ( )?
0
Mr. Plinko
Top achievements
Rank 1
answered on 23 Sep 2009, 03:32 PM
Couldn't you use:
gridItem.OwnerTableView.DataKeyValues[gridItem.ItemIndex][UniqueName].ToString();
?
gridItem.OwnerTableView.DataKeyValues[gridItem.ItemIndex][UniqueName].ToString();
?
0
Ahrensberg
Top achievements
Rank 1
answered on 24 Sep 2009, 08:09 AM
gridItem.OwnerTableView.DataKeyValues contains only the first item. I have 9 columns, but only the first one column is stored in DataKeyValues. For all other index values it is (therefore ofcause) null.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 24 Sep 2009, 08:51 AM
Hi,
Note: The cell values will not be rendered in the ItemCreated event of the grid, hence you should use the ItemDataBound event in order to access the cell values.
Try out the following code in the ItemDataBound event of the grid, to set tooltips for cells in the grid based on their text values:
c#:
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| GridDataItem gridItem = (GridDataItem)e.Item; |
| foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns) |
| { |
| if (column is GridBoundColumn) |
| { |
| gridItem[column.UniqueName].ToolTip = gridItem[column.UniqueName].Text; |
| } |
| } |
| } |
| } |
Thanks
Shinu.
0
Ahrensberg
Top achievements
Rank 1
answered on 24 Sep 2009, 09:37 AM
Hi Shinu,
Arh! I used OnItemCreated before.
Thank you very much! :o) It solved my problem..
Arh! I used OnItemCreated before.
Thank you very much! :o) It solved my problem..