Is there a way to make the dropdown list width adjust to accomodate the width of the items without wrapping? Standard asp.net dropdown list does it if the width is not specified.
3 Answers, 1 is accepted
0
Accepted
Rosi
Telerik team
answered on 20 Aug 2008, 07:19 AM
Hi Eliyahu,
You can change the width of the dropdown by using the DropDownWidth property. However RadComboBox does not support automatic change of the width according to the width of the items.
Kind regards,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Please consider this a feature request. You should be able to determine the maximum width required for the dropdown client-side via some javascript/DOM operations.
Without this, we need to either make guesses about client font-sizes/characters or "build for the largest possible width" -- either of which is ugly.
0
Rosi
Telerik team
answered on 30 Oct 2008, 07:18 AM
Hello Ian Darke,
You can try set the width dynamically depending on the item with the widest text. Here is how:
int maxWidth = 0;
foreach (RadComboBoxItem item in RadComboBox1.Items)
{
int itemLength = item.Text.Length;
if (itemLength > maxWidth)
{
maxWidth = itemLength;
}
}
RadComboBox1.DropDownWidth = maxWidth * 7;
I hope this helps.
Best wishes,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.