"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Wednesday, March 9, 2011

Tooltip on Dropdown or Solving, content on the dropdown exceed the size of the dropdown



Hai,
As so many people engaged the problem of content on the dropdown exceed the size of the dropdown. It happens when dropdown size is predefined.By avoiding that predefine v can, but some designer not allow us to change their design as per our need. i faced this fucking problem in my last firm.To solve this problem i tried to use tooltip Here comes that.
DEMO
Code:
<select name="DropDownList1" runat="server" id="DropDownList1"
 onmouseover="this.title=this.options[this.selectedIndex].title"
        style="width: 120px;">
       <option value="1" title="www.SimplyAsp.net">www.SimplyAsp.net</option>
       <option value="2" title="www.SimplyAsp.Blogspot.com">
www.SimplyAsp.Blogspot.com</option>
       <option value="3" title="Arun Aravind">Arun Aravind</option>
        </select>

C#

 foreach (ListItem li in ddlProject.Items)
        {
            li.Attributes.Add("title", li.Text);
        }
Hope it helps u.... Stay tune...
Have a nice day... 'N happy Coding :)

No comments: