how to increase Drop Down List capacity in asp.net - asp.net

How can you increase Drop Down List capacity in asp.net? I have to display 20,000 items in a single DropDownList but it not showing all items after binding. Some items are missing.
How can I achieve this?

I'm not aware of any direct limitation applied by the .NET framework; there may be a limit applied by the client, but I'm not sure. 20,000 is a lot of items and a lot of HTML to render, and HTML rendering is one of the bigger performance problems. You may want to instead consider an alternative approach like an AutoComplete feature, such as this.

There is no reason the dropdown list selection would be missing items.
Check your data source before binding to make sure all the items are there, it could be an issue with the query filling the data source rather than the dropdown list missing items.
Though as people have pointed out, replace this with either a search function or a autocomplete function dropdown lists should not be a place for 20,000 items.

Related

.NET dropdownlists with huge number of items

I am working on a webpart which makes use of 5 dropdowns (each dropdown represents 'Project' table columns like projectNo, ProjectPM, ContractNo etc). The table has more than 3000 items, so when the dropdownlists are finally databound, they have more than 3000 items to load, which pretty much brings IE to a halt.
What is the best way to go about architecting a solution, so users can still make use of the dropdown list interface, may be like first rendering an empty dropdownlist and then using a modal window to first find the project number they are looking for and then set the item as selected in the dropdownlist. I am envisioning the following UI. Can anyone guide me on how I should go about solving this issue?
-------------------
|V| [SearchBtn]
-------------------
-------------------
|V| [SearchBtn]
-------------------
-------------------
|V| [SearchBtn]
-------------------
[FindProjectBtn]
Clickikng on the searchBtn basically brings up a popup window where they can search for their stuff, and when they click on the matched result, it will set the dropdownlist.
When working with dropdown lists, a good rule-of-thumb is to keep the list short so you do not experience browser performance issues. If you have thousands of items to look through you can:
Create a search component whereby the user enters a part of the project name they are searching for and display a simple grid for them to choose from.
Implement a type-ahead mechanism. The user enters the first couple of letters of what they are searching for. You can query your DB for the top 10 hits and return them via AJAX.
If you have 3000 items, then definitely drop down list will not be a right designing decision.
using any kind of repeater lists with paging, sorting and searching functions is highly recommended in your case.
but if you insist to have a kind of drop down list view then Matthew's suggestions are your answer.

Dropdownlist - number of display element

I have dropdownlist on my webpage.
When I click it the list with all items is expanded. But this list is very long.
How can I change it to achievie a list with (e.g.) 5 displayed items and with a scrollbar next to them.
If it is not possible, how can I do it with ListBox? I know it is Rows property there but can I declare how many rows is display all the time not after expanding the list.
This control, will, of course be rendered on the page as a standard <select> control.
With these, the height of the list once its dropped down is determined by the browser, and you have no control over this. You'll notice when the list approaches the foot of the page, the browser will implement the scrollbar as you suggested, but not with the number of items you maybe want.
My only suggestion would be to investigate the options offered by some client-side drop down add-ins. You may be able to find some jQuery ones that will help.
A simple google search for "jquery dropdowns" yielded this article as the top result: 38 jQuery And CSS Drop Down Multi Level Menu Solutions. If you can't find something here then there are also plenty similar sites in the search results.
I think this post provides you with a couple of different solutions to your problem.
http://blogs.msdn.com/b/rakkimk/archive/2011/05/02/dropdownlist-html-select-vertical-scrollbar-number-of-items.aspx

showing top n options in a dropdownlist

Consider an ASP.NET server control DropDownList (or <input type='select'>) with a large number of options (e.g. 100 options). When clicking on the list, the full list of 100 options are shown. They're all displayed, and run off the screen.
How can the control's picklist size be resized or limited to the first n options?
Frédéric Hamidi has already given the short answer, however he has also referred you to a perfect alternative. Explore this and that is similar to what I had done when I faced similar situation.
Idea is that you don't populate your list. This way your drop down will be empty and in place of that you show a div with scrollbar and whatever you wish. Align this div in such a way that user thinks, "it is the dropdown".

jQuery manipulation of duplicate tags

Ok, this is a weird request, but I need to use jQuery to manipulate a bunch of tags that all have the same id and name.
We're using Izenda AdHoc reporting controls, which has a query designer GUI. It gives you a select dropdown with a list of tables in it, and you can click a button and get another one, and another and another etc. to build your query.
Every time you click for a new table it posts back to the server, and comes back with a new row in the table, with the same controls as the row above, including an identical select tag, with the same id and name attributes. How ASP.NET is generating this is beyond me.
But I was using jQuery to modify the length of the dropdowns as they are too short. Strangely enough, even though they all have the same id, using jQuery like:
jQuery("#ctl00_ContentPlaceHolder1_queryBuilder_ctl101_jtc_Table").width(250);
will only change the first dropdown. I need to widen them all, but they all have the same ID. And there are lots of other select tags I dont want to touch.
Any ideas?
EDIT:
Now that I think about it, I have no idea how this even works. The page poasts back, saves the datasources etc. everything seems to work, but I have no idea how ASP.NET tells one dropdown from another. But it does work.
$("#yourid") will only match the first one (since, of course, all your IDs should be the unique).
If you can't have unique IDs then it's possible to access them using the attribute equals selector
$("input[id='yourid']");. This will return all of the matching elements.
See it working : http://jsfiddle.net/jonathon/22mpK/
You will need to access them via some other selector. since the javascript specs call for unique ID's, jQuery will only act on the first matching unique ID. If there's a class higher up the DOM and you can consistently reach your element via some DOM-related path, you may want to attack your problem that way.
such as have each table render in a div of class "whateverClass" and use $('.whateverClas table').width(250);
I'd have to do some testing, but the only other solution I could think of would be to do a looped $("#ELEM").not(".classed").addClass("classed"); to give each duplicate ID a selectable class..?
It is not very surprising the jQuery only adjusts one of your selects.
DOM IDs should be unique across a page, and even though browsers do not complain too much about it, selecting elements by ID in javascript will only give you random results if several elements have the same ID.
you should try selecting the tables via their element names and position in the page.
for instance let's imagine your tables are inside the 3rd div in the page :
jQuery('div:eq(2)>table').width(250);
you should take a look at all the structural selectors available on api.jquery.com and build a structural selector without using the ID.
I hope this will help you
Jerome Wagner

Flex collapsible field group control

I am trying to make a side panel in a Flex application that would hold a bunch of properties of a selected object. The number of properties may become huge, but they all fall into some certain categories.
For that, I am looking for a flex control that would be like a collapsible field group. Or like an accordion that can have multiple open panels at a time. Do you know, where can I get one?
UPDATE: I want something like the second example on the following page: http://extjs.com/deploy/dev/examples/form/dynamic.html
Thanks,
Artem.
http://www.flexdownloads.com/#view=detail;vstr1=19
is what you are looking for.
It sounds to me like you are looking for some sort of tree component. Flex actually has one of those and you should probably take a look at it.
This is a good link to see what controls are included in flex http://examples.adobe.com/flex3/componentexplorer/explorer.html

Resources