DropDownList - ToolTip

G

Guest

hi all,
i tried to create foreach item in DropDownList a ToolTip.
It doesn't work. any idea ?

DropDownList ddl;
DataTable dt = (DataTable)Session["list"];
foreach (DataRow dr in dt.Rows)
{
ListItem li = new ListItem(dr["name"].ToString(),
dr["id"].ToString());
li.Attributes["title"] = "1111";
ddl.Items.Add(li);
}
 
E

Eliyahu Goldin

ListItem renders as an option html element which doesn't support title
property.

Eliyahu
 
Joined
Oct 31, 2006
Messages
2
Reaction score
0
I succeded showing the tooltip using an ajax enabled control (MagicAjax)

You must create a SelectedIndexChanged Event
Code:
Private Sub ddlIndicadores_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlIndicadores.SelectedIndexChanged
[COLOR="SeaGreen"]' This refers to a database[/COLOR]
            Dim objIndicadores As New Indicadores

[COLOR="SeaGreen"]' Next I select the text sending the value param to a function...[/COLOR]
            objIndicadores.Seleccionar(CType(ddlIndicadores.SelectedValue, Integer))

[COLOR="SeaGreen"]' ...and returning the value[/COLOR]
            ddlIndicadores.Attributes("title") = objIndicadores.Nombre
        End Sub

Note to use ddl.AutoPostBack set to TRUE in the Page_Load, and if you don`t use a database you can success using a Enum for the items in the ddl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top