.NET dropdownlists with huge number of items - asp.net

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.

Related

ASP.net: Complex validation of dynamically created DropDownLists

I have a GridView with records of the database.
I create two DropDown lists dynamically for each selected item. That means, if I click select, two DropDown lists appear, the first one defines a start position, the second one a stop position. Both includes numbers (depending on how many items I have selected). If I have selected 5 items, all DropBox controls include the values 1 - 5. Everything is done by code behind.
Now I want to validate that. The stop Control shall be set to a higher one as the start control. Further more, each area that is already used, is not allowed for the next controls. E. g. if I select in the first pair of DropDown lists the area 1-5, I shall not be able to choose 2-6 with the next pair of controls.
How can I do that. I thought about javascript but that could be very tricky because everything is done with code behind. The validation controls are nice, but I don't know how to validate such a complex thing...
Any Ideas?
thank you for your answers!
I dont wont to do a async postback each time, especially because the lists shouldnt be limited during the changes. I solved it in that way:
The user clicks on save, I create a bool array for each dropdown item, then I loop through all dropdownlists in the placeholder. If there is a area from 3 - 5 I set the values with index 3-5 in my bool array to true. If one of these values is already true, there must be a wrong selection in the start/stop positions.
I think, its not a very nice way but works pretty fast and does everything I want. If someone has a better idea, please let me know... ;)
Thanks!
Stefan

how to increase Drop Down List capacity in 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.

Telerik RadScheduler - select multiple resources

I'm using Telerik scheduler to display a Timeline view of meetings. The resources derive from the Person class, and they are Advocate, and Legislator.
On the Y axis, I am listing Advocates, and on the X axis, I am listing blocks of time in one hour increments.
When I double click an appointment, the Edit Appointment modal dialog pops up and lists Advocates and Legislators.
Since meetings will have multiple advocates and possibly multiple legislators in attendance, I would like to have a checkbox list inside the resource dropdowns on the edit screen. Is there any way to accomplish this?
I believe this will allow me to solve one problem in that, if Peter Pan and Homer Simpson both are to attend the same meeting, clicking the meeting in the row for either of those two advocates will display 'Peter Pan' in both instances (or sometimes '-', not yet sure where that comes from) rather than 'Homer Simpson' where I open up the meeting from his row.
If it is not possible to introduce checkboxes to the resources list, can you suggest an alternate way around the ultimate issue in the above paragraph? Thanks in advance.
Telerik supports the adding of a listbox to support what you are trying to do. On the Scheduler itself add the code below that mimics your field names that your advocates are pulling from in your DB:
<ResourceTypes>
<telerik:ResourceType DataSourceID="SqlDataSource2" ForeignKeyField="Adv_AdvocateID"
KeyField="Adv_AdvocateID" Name="Advocate" TextField="Adv_FullName" AllowMultipleValues="true" />
</ResourceTypes>
The next step is to populate the resources using a custom provider. See this program here for a great project in which you can see resource population in action. Using the SchedulerDBProvider class you can then adjust their example to more represent your fields and populate the appointments accordingly with your desired ResourceTypes.
In terms of getting that particular drop down to have multiple selections via checkboxes you would most likely have to define your own custom advanced template. This route allows you to take a UserControl and use that as the edit view for your appointments. There's a demo that displays all of this (including source code) right here.
However, having that RadComboBox there might not even be the ideal approach to take. What about just a simple list of checkboxes? This demo shows off how a very simple declaration for the RadScheduler can achieve this functionality. Additionally, there is some code-behind (both in C# and VB.NET) that shows off how you can customize the text on each appointment, which might be helpful in the case that you're referring to.

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

Webforms App Layout Opinions?

I have a very simple webforms app that will allow field techs to order parts from the warehouse.
Essentially it work like so:
User selects a category from a filter dropdown, which then binds items of that category to a gridview control
User finds an item in the gridview and inputs a desired quantity (in a text box in a template field in each row)
User repeats 1 & 2 as needed
User sees a summary of the complete requisition
User confirms items and submits the requisition for processing
My no-brainer UI design so far is the generic dropdown-above-a-gridview where there's a category drop-down list that filters a gridview, like in the eye-catching asp.net ado tutorials:
    http://static.asp.net/asp.net/images/dataaccess/15fig01vb.png
Each gridview row (in my app, not in the image above) lists an item's details and can accept a quantity input in the template textbox if the user wants to requisition that item.
Given that a user will want items from different categories during a single usage session, I'm trying to figure out a good, user-friendly way to allow users to input a quantity for an item, have a warm fuzzy feeling that their input has been accepted/stored, then change the category filter (thus binding the gridview to a different set of data) and select other items from the gridview as many times as necessary before summing up their order and submitting it.
I've thought about putting another grid below the first and adding items to it dynamically as the user selects each item. But that seems awkward. Ditto with an unordered list or similar simple structure under the grid.
I've also thought about just storing the user's picks in view state or session state and displaying a summary on another page, kind of like a shopping cart sort of functionality. Maybe do that and use some sort of ajaxy goodness on the main page to display something warm and fuzzy when a quantity is input?
WWYD? What Would You Do?
TIA.
I strongly agree with your first choice: users need to see somewhere what they have chosen or they will probably keep choosing it over again thinking it failed. Waiting to display it on a summary page shouldn't even be an option. I don't see much wrong with binding to another grid, although a repeater is also a decent option. Well, there are many options. Anyway, if there is room to do this off to one side or another - especially the left- I definitely would, rather than at the bottom. Also, bonus points for enabling users to change the quantities (or delete all) of an item they already selected, wherever you choose to display this.
I like the idea of a search, but be careful with auto-complete. Google style is good where it displays results below, but I've seen people develop some that are way too aggressive and love to write over what you're typing: this is awful. Good luck.
Probably because both your choices are fine - it comes down to personal preference. The shopping cart idea is well known. But sometimes it gets old if you have to keep going back and forth between the cart and the item selection.
What's wrong with the separate grid? -That way you keep the selection list separate from the ordered items list?
Why tie the user to selecting the correct category and then selecting the quantity and hitting a button?
Why not use some type of autocomplete search so they can type in the produce name they want? Then a user could type "widg", get a drop town of choices, hit tab to go to a quantity field, enter a number, and then hit enter.
Display a quickie preview with the aucocomplete too, like as single row of your data.
Then throw all these into another grid at the top of the page if its a critical part of the application, maybe at the bottom if you think the actual grid results are important.
The reason I don't like category drop downs is people who are familiar with their jobs or company usually know the names and even skus numebers for what they are trying to do. Having them select a category instead of typing just slows them down. Also I hate running into the "which category is this?" moment. For example, is a chicken a pet, food, livestock, or food producer?

Resources