DropDownList tooltip

for (int i = 0; i < GridView1.Rows.Count; i++)
{
    //Add logic to fill the GridView

    //Now let's iterate through the DropDown controls to add a "Title" to the
    //resulting HTML "<option>" elements: this will add the toolip to highlighted element
    for (int i2 = 0; i2 < dropDownList.Items.Count; i2++)
    {
        dropDownList.Items[i2].Attributes.Add("Title", dropDownList.Items[i2].Text);
    }
}

tooltip in IE7

Even if Firefox (at least the version I’ve tried) does not respect the control width we have set through CSS and the DropDown for this sample is large enough to read the complete text, the tooltip is displayed:

tooltip in Firefox

posted @ 2008-09-27 14:45 真见 阅读(724) 评论(0) 编辑 收藏