H
hansiman
I want to add tooltexttips to a datagrids column headers. The code
below handles BoundColumn but not TemplateColumn - and I can't figure
out how to have it handle both.
' add tooltip text to selected header column cells
Private Sub dg_ItemCreated( _
ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Handles dgSkema2a.ItemCreated
If e.Item.ItemType = ListItemType.Header Then
Dim idx As Integer = 0
Dim cl As TableCell
For Each cl In e.Item.Cells
If InStr(cl.Text, "HR") > 0 Then
With cl
.ToolTip = GetToolTip(idx)
.Attributes.Add("style", "cursor:help;")
End With
End If
idx += 1
Next
End If
End Sub
/Morten
below handles BoundColumn but not TemplateColumn - and I can't figure
out how to have it handle both.
' add tooltip text to selected header column cells
Private Sub dg_ItemCreated( _
ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Handles dgSkema2a.ItemCreated
If e.Item.ItemType = ListItemType.Header Then
Dim idx As Integer = 0
Dim cl As TableCell
For Each cl In e.Item.Cells
If InStr(cl.Text, "HR") > 0 Then
With cl
.ToolTip = GetToolTip(idx)
.Attributes.Add("style", "cursor:help;")
End With
End If
idx += 1
Next
End If
End Sub
/Morten