Saturday, 6 October 2012

Applying ToolTip to each list item in an Check Box List

I have myself faced this problem, so I am sharing this very useful code with everyone. 

When we are using Check Box List in ASP.NET then it is sometimes required to display a tooltip on each item in the list. There is no attribute as tooltip of the list items but we can achieve this by using the "title" attribute of the items while traversing through the list.

The following C# code does the same thing:

foreach (ListItem lstItem in cbxlstProducts.Items)
{         
    lstItem.Attributes["title"] = "<YourToolTipHere>";     
}

No comments:

Post a Comment