Sunday, 28 October 2012

JavaScript: Copy to Clipboard

Sometimes it is required to provide the functionality of Copying value to Clipboard. This small piece of javascript lets up do exactly the same thing.

window.clipboardData.setData("Text", <TheTextToBeCopied>);

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>";