asp.net 2.0 – Splitting Titles in DropDown – Education Career Blog

My application Drop-down consist of lengthy titles, which exceeds the drop-down beyond the page.

Example Title:
Enter your Name Up to 250 Char Enter your Name Up to 250 Char Enter your Name Up to 250 Char Enter your Name Up to 250 Char.

i can split half of the title with sub string().
Is it possible to bring the next half of the title to next line in Drop-down using C#.

,

I’m not aware of any property of the DropDownList control that allows you to wrap text, but when I’ve had items in a DropDownList that exceed the width of the control, I add a tooltip that displays the full text of the item when the mouse hovers over it.

You can do this in code-behind after you’ve populated the DropDownList:

C#

foreach (ListItem item in DropDownList1.Items)   
    item.Attributes.Add("Title", item.Text);

VB

For Each item As ListItem In DropDownList1.Items
    item.Attributes.Add("Title", item.Text)
End For

Leave a Comment