Pages

Subscribe:

Ads 468x60px

Monday, June 20, 2011

How To Add Tool Tip for DropDownList items in Asp.Net


1<asp:DropDownList ID="DropDownList1" runat="server" ondatabound="DropDownList1_DataBound">
2</asp:DropDownList>



Code for .CS File


protected void DropDownList1_DataBound(object sender, EventArgs e)
02{
03    DropDownList ddl = sender as DropDownList;
04    if (ddl != null)
05    {
06        foreach (ListItem li in ddl.Items)
07        {
08           li.Attributes["title"] = li.Text; // setting text value of item as tooltip
09        }
10    }
11 
12}

No comments:

Post a Comment