attributes to ListItemType.Header

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
 
H

hansiman

Forgot to mention that I only want specific columns to have the
attributes: instr(cl.text, "HR") > 0

....and here lies the problem.
cl.Text of a BoundColumn returns column header text
cl.Text of a TemplateColumn returns ""

I can't find the correct property!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top