Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to auto expand a dropdownlist?

Status
Not open for further replies.

MzKitty

Programmer
Oct 28, 2003
254
US
I'm using vs 2008 to write a web based ticketing system and I have several dropdownlists that I want to auto expand when they are clicked on. I don't want to have to make the box bigger to show the two fields. The one field is 50 characters so it would take up most of a line. The properties of the dropdownlist on a webform does not reflect auto resizing.

Thanks
Cathy
 
What do you mean by auto expand? Width? Height? And what do you mean by the box and two fields? Maybe you could draw a diagram of what you want?

Also, if this is something that will be happening on the client's browser, you will most likely need Javascript not ASP.NET to achieve any effects so you may be better off showing the rendered HTML in a question in that forum.

Mark,

Darlington Web Design[tab]|[tab]Experts, Information, Ideas & Knowledge[tab]|[tab]ASP.NET Tips & Tricks
 
The drop down list, like most DOM elements is very simple. W3Schools has a good summary of the html drop down list element.
if you want something like this
[tt]
+------------+-+
| option 1 |*|
+------------+-+--------------+-+
| option 2................... |*|
| option 3................... | |
| option 4................... | |
+-----------------------------+-+
[/tt]
or
[tt]
+---------------+-+
| option 1 |*|
+---------------+-+
| option 2 |foo |*|
| option 3 |bar | |
| option 4 |fu | |
+---------------+-+
[/tt]
you have 1 of 2 choices:
1. create it your self.
2. use a 3rd party control.

creating it yourself will require knowledge of the DOM, CSS and javascript, as well as developing custom ui controls for webforms.
I believe companies like ComponentOne and Telerik have a rich drop down list control. I'm sure others do as well. I'm not aware of pure client scripts that do this.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
This is going to run on our intranet for another division that is currently using a bad access system. What I'm looking for is a way for the dropdown to display two fields. The first one has up to 14 characters and the second has up to 50 characters. I don't want to set my width to accomodate both fields because it would take up most of one line. What I would like is a box that is only 75px on the form, but when you click on it, shows all of both fields. I found on an asp forum a suggestion to not set the width size; that the box when you click on it will automatically expand. I'm going to try that and see if that will take care of my problem. Thanks for answering so fast!
 
this doesn't exist in html or webforms.
1st. only a single line o ftext is displayed, there aren't fields/columns on the drop down. you could format your data into "columns", but this is just formatting, the web interprets this as text.
2nd. not setting the width will expand the "text box" and the list of items to the maximum width.

to get what you want you will need to manipulate the DOM on the client. this will require DOM, CSS & JS. forum215 and forum216 will be able to provide better assistance with this.
These forums are not concerned about the server side language, so providing webforms code will only confuse (and possibly annoy) the members of those forums.

there is also the option of purchasing a webforms control that does this.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks Jason. I'll check out the link to the other forums.

Cathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top