Click here to Skip to main content
15,920,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Create a tooltip for Dropdownlist each Items it's Work on with Using Mouse.

plase any one can help me
Posted

Try like this-
C#
public void Tooltip(ListControl lc)
{
    for (int d = 0; d < lc.Items.Count; d++)
    {
        lc.Items[d].Attributes.Add("title", lc.Items[d].Text);
    }
}



try this link-
http://www.dotnetspider.com/resources/5099-Tool-tip-for-DropDownList-ASP-NET.aspx[^]
 
Share this answer
 
 protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
BindDropdown();
}
}
protected void BindDropdown()
{
SqlConnection con =new SqlConnection("your connection string ");
con.Open();
SqlCommand cmd = new SqlCommand("select UserId,UserName from UserInformation", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddlDetails.DataTextField = "UserName";
ddlDetails.DataValueField = "UserId";
ddlDetails.DataSource = ds;
ddlDetails.DataBind();
}
protected void ddlDetails_DataBound(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
if(ddl!=null)
{
foreach (ListItem li in ddl.Items)
{
li.Attributes["title"] = li.Text;
} 
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900