|
-
Jan 31st, 2006, 02:33 PM
#1
Thread Starter
Hyperactive Member
ToolTip in a Datagrid? (resolved)
i used the code below to set the tooltip of an item once you click on it BUT how can you load the tooltip when the datagrid is loaded?
VB Code:
Dim dgCellDiag As TableCell = e.Item.Cells(3)
Dim dgDiag As String = dgCellDiag.Text
Select Case e.CommandName
Case Is = "diag"
e.Item.ToolTip = dgDiag
End Select
Last edited by texas; Feb 2nd, 2006 at 08:57 AM.
-
Jan 31st, 2006, 05:13 PM
#2
Re: ToolTip in a Datagrid?
You can use the datagrid's ItemDataBound handler.
The event gets fired each time a Ds row gets added to the grid.
Example:
VB Code:
Private Sub Dg_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles Dg.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
'do something
End if
End Sub
That will affect all the items in the Dg, not touching the header or the footer.
HTH
HoraShadow
EDIT: my vbcode tag it's not working?
I do like the reward system. If you find that my post was useful, rate it.
-
Feb 1st, 2006, 12:07 PM
#3
Thread Starter
Hyperactive Member
Re: ToolTip in a Datagrid?
this is what i did... and thank you for the idea.
VB Code:
Private Sub dgService_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgService.ItemDataBound
Dim dgCellDiag As TableCell = e.Item.Cells(3)
Dim dgCellProc As TableCell = e.Item.Cells(5)
Dim dgDiag As String = dgCellDiag.Text
Dim dgProc As String = dgCellProc.Text
e.Item.Cells(2).ToolTip = dgDiag
e.Item.Cells(4).ToolTip = dgProc
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|