Bind or Adding tooltip for dropdownlist items in

DataBase Table:

first create databasetable as follows:

WebForm Design:

simply add one dropDownList to webform:

<asp:DropDownList ID=”DropDownList1″ runat=”server”

Connection string:

first prepare connection string in web.config file under configuration tag  as follows:

<add name=”ConnectionString” connectionString=”Data Source=server2;Initial Catalog=Venkat123;Persist Security Info=True;User ID=sa;Password=123″/>

Code Behind:

string connection = ConfigurationManager.ConnectionStrings[“ConnectionString”].ToString();
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
{ FillDDL(); }
public void FillDDL()
SqlConnection con = new SqlConnection(connection);
SqlCommand cmd = new SqlCommand(“select UserId,UserName from Emp”,con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
DropDownList1.DataValueField = “UserId”;
DropDownList1.DataTextField = “UserName”;
DropDownList1.DataSource = dt;
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;



One thought on “Bind or Adding tooltip for dropdownlist items in

  1. This is a nice article. I have found another link that help to developers to create custom tooltip with custom dropdown

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s