Learning While Aging

CheckBoxList and Tooltip

The built-in Tooltip for the CheckBoxList control displays information for the whole CheckBoxList, but what if I want to have a tooltip for each listitem in the CheckBoxList?

The ListItem has a very nice property called “Title” which can be used to generate a “tooltip” effect.

Here is the code snippet:

VB.NET

Private Sub CheckBoxList1_DataBound(ByVal sender As Object, _
                ByVal e As System.EventArgs) Handles CheckBoxList1.DataBound
    For Each i As ListItem In Me.CheckBoxList1.Items
        i.Attributes.Add("Title", "Tooltip information goes here.")
    Next
End Sub

C#

protected void CheckBoxList1_DataBound(object sender, EventArgs e)
{
    foreach (ListItem i in this.CheckBoxList1.Items)
    {
        i.Attributes.Add("Title", "Tooltip information goes here.");
    }
}

Please let me know if this is helpful to you.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x