Tooltip on cell in DataGrid?

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

I need to have a Tooltip on each Cell in a datagrid, I don't know how to do
this. I'm using Styles to the datagrid (Which I asume most people do since
you never need to show all the fields from the source).

The Cell I want a tooltip on is styled with a textboxcolumn and the TextBox
Object in that TextBox Column doesn't seem to have a property called
Tooltip.. so i'm sorta stranded here...

Best regards/
Lars
 
Lars, based on your post above, maybe you've already figured this out:

Private Sub grdMenu_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
Handles grdMenu.ItemDataBound

If e.Item.ItemType = ListItemType.AlternatingItem Or _
e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.SelectedItem Then

Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim ctl As WebControl = CType(e.Item.FindControl("lblDesc"),
WebControl)
ctl.ToolTip = drv("ExtDesc").ToString

End If

The gist is that at ItemDataBound, go get your control, and then add your
text to the tooltip property. In my case the grid shows "Description" for an
item, and I put the "Extended Description" in the tooltip.

hth,

Bill
 
Back
Top