Hi, I have a RadGrid that gets bound with template columns that contain a single image (it's an indicator light). Here's the code for the template column:
| Public Class GridImageItemColumn |
| Inherits GridTemplateColumn |
| Public Class GridImageItemTemplate |
| Implements ITemplate |
| Public column As GridImageItemColumn = Nothing |
| Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn |
| Dim image as New Image() |
| image.ID = Me.column.UniqueName |
| container.Controls.Add(image) |
| AddHandler image.DataBinding, AdressOf image_DataBinding |
| End Sub |
| Private Sub image_DataBinding(ByVal sender As Object, ByVal e As EventArgs) |
| Dim dataItem As GridDataItem = CType(CType(sender, Control).NamingContainer, GridDataItem) |
| If dataItem IsNot Nothing Then |
| Dim image As Image = CType(sender, Image) |
| image.CssClass = "t_img" |
| Dim value As String = DataBinder.Eval(dataItem.DataItem, Me.column.DataField).ToString() |
| If Not String.IsNullOrEmpty(value) Then |
| image.ImageUrl = "~/images/" & value & ".png" |
| End If |
| End Sub |
| End Class |
| Public Sub New() |
| Dim template As New GridImageItemTemplate() |
| template.column = Me |
| Me.ItemTemplate = template |
| End Sub |
What I'm wondering is, how can I dynamically tooltipify these indicator lights? I've tried to do it via how the example states:
| Me.RadToolTipManager1.TargetControls.Add(target.ClientID, (TryCast(e.Item, GridDataItem)).GetDataKeyValue("ID").ToString(), True) |
but .. that doesn't work since I have no way to find the target Image control, since the name isn't static (it isn't static, because there are n number of these columns).
Any clues?