ToolTip

J

Jim Heavey

Hello, I am looking a coding example that allows you to add toolTips to a
column in a datagrid. It works just fine ins the supplied code, but when I
attempt to apply it to my program, it fails with a out of bounds exception.

The example is applying toolTip to a HyperLinkColumn, which is the first
column in the datagrid, and I am attempting to apply it to a "BoundColumn".

Here is the code...
Dim liType As ListItemType = e.Item.ItemType
If liType = ListItemType.Item Or liType = ListItemType.AlternatingItem Then
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
Dim cellValue = e.Item.Cells(0).Text
Dim control As Control = e.Item.Cells(0).Controls(0)
CType(e.Item.Cells(0).Controls(0), WebControl).ToolTip = "My Custom
ToolTip"
End If

Last line of the If Statement is the one failing. I looked at the
"WebControl" class and BoundColumn is one of the controls apllicable. Why is
it failing?
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top