Home All Groups Group Topic Archive Search About
Author
24 Nov 2008 1:58 PM
rum23
Is there a  way to change the width of the dropdown list width? I don't want
to change the width of the dropdown control. This needs to be fixed width. I
only want to adjust the size of the drop down list of a combo box to fit the
size of the longest string in its items. How do I do this for asp:dropdown
control.

thanks.

Author
25 Nov 2008 4:16 AM
Nathan Sokalski
Just use the CSS width property. The DropDownList automatically expands to
the width of the longest ListItem unless otherwise specified, so normally
you won't even need to do this. Am I somehow misunderstanding what you are
really trying to do? Good Luck!
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"rum23" <ru***@discussions.microsoft.com> wrote in message
news:0E711C83-9063-497F-86C9-7124161E2DBE@microsoft.com...
>
> Is there a  way to change the width of the dropdown list width? I don't
> want
> to change the width of the dropdown control. This needs to be fixed width.
> I
> only want to adjust the size of the drop down list of a combo box to fit
> the
> size of the longest string in its items. How do I do this for asp:dropdown
> control.
>
> thanks.
Author
25 Nov 2008 4:09 PM
rum23
thank you for responding, but this is not what I'm looking for.

I have to keep the widht of the combox box to a fixed width. I don't want to
change this fixed width at any time due to real estate on the page.

I want to increase the width of the List (this is the list that displays
when you click on the down arrow in the combo box). I want the width of this
list to be set to the longest item width.

In windows form, you can do this by simply setting the "ListWidth" property
for a comobox and I'm looking for something similar in asp web controls.

Please let me know if my question is not clear. Thanks much.

Show quoteHide quote
"Nathan Sokalski" wrote:

> Just use the CSS width property. The DropDownList automatically expands to
> the width of the longest ListItem unless otherwise specified, so normally
> you won't even need to do this. Am I somehow misunderstanding what you are
> really trying to do? Good Luck!
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
> "rum23" <ru***@discussions.microsoft.com> wrote in message
> news:0E711C83-9063-497F-86C9-7124161E2DBE@microsoft.com...
> >
> > Is there a  way to change the width of the dropdown list width? I don't
> > want
> > to change the width of the dropdown control. This needs to be fixed width.
> > I
> > only want to adjust the size of the drop down list of a combo box to fit
> > the
> > size of the longest string in its items. How do I do this for asp:dropdown
> > control.
> >
> > thanks.
>
>
>
Author
25 Nov 2008 6:09 PM
Brian Kenneth Nielsen
Hi there

If you want to make the dropdown more width, that the field that shows
the selected item.

Then you need to build the control your self.

The <select> will not do that for you.
Instead you have to make some good old DHTML. with an <input type=text
readonly>, that shows you the selected item. Then have a button with the
downarrow. This button must take the click event in javascript, and on
click show a <select> with multiple rows eg. 6 or 10 or what you deside.
When mouse moves out of this control, hide it.. if user selects an item,
then copy the item to the input field, and hide the control.

Hope you get the idea. In this way, you can have differente style for
<input> field, that shows the selected value, and the <select> which
only is visible, when the button is clicked.

Best regards and happy coding.
Brian Kenneth Nielsen
http://www.bknnet.dk/


rum23 wrote:
Show quoteHide quote
> thank you for responding, but this is not what I'm looking for.
>
> I have to keep the widht of the combox box to a fixed width. I don't want to
> change this fixed width at any time due to real estate on the page.
>
> I want to increase the width of the List (this is the list that displays
> when you click on the down arrow in the combo box). I want the width of this
> list to be set to the longest item width.
>
> In windows form, you can do this by simply setting the "ListWidth" property
> for a comobox and I'm looking for something similar in asp web controls.
>
> Please let me know if my question is not clear. Thanks much.
>
> "Nathan Sokalski" wrote:
>
>> Just use the CSS width property. The DropDownList automatically expands to
>> the width of the longest ListItem unless otherwise specified, so normally
>> you won't even need to do this. Am I somehow misunderstanding what you are
>> really trying to do? Good Luck!
>> --
>> Nathan Sokalski
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>> "rum23" <ru***@discussions.microsoft.com> wrote in message
>> news:0E711C83-9063-497F-86C9-7124161E2DBE@microsoft.com...
>>> Is there a  way to change the width of the dropdown list width? I don't
>>> want
>>> to change the width of the dropdown control. This needs to be fixed width.
>>> I
>>> only want to adjust the size of the drop down list of a combo box to fit
>>> the
>>> size of the longest string in its items. How do I do this for asp:dropdown
>>> control.
>>>
>>> thanks.
>>
>>