.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Add Tool Tip for DropDownList items in Asp.Net

Posted By:Ravi Ranjan Kumar       Posted Date: June 16, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

This Code enable you to add tooltip for DropDownLIst using ASP.Net

You can use given sample code to adding tooltip to DropDownList. you need to just adding Title attribute to the list item in DataBound event.

and Now below code in Code behind file 

protected void DropDownList1_DataBound(object sender, EventArgs e)
    DropDownList ddl = sender as DropDownList;
    if (ddl != null)
        foreach (ListItem li in ddl.Items)
           li.Attributes["title"] = li.Text; // setting text value of item as tooltip



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend