1

I am developing an asp.net mvc web application.

When creating a document I need to select "PartName" and "IssueNo". "PartName is to be populated from a database which has more than 15000 records. The database table for parts contains Part details along with the PartName and the IssueNo of each part.I need to filter "PartName" when its name is enter.

Also the 'IssuNo' is to be populated based on the PartName entered(ie. PartName and IssueNo should be cascading). Which is the right method to attain this?

Thinking loud... I thought of 2 options:

  1. Create a dropdown for partName and populate the entire load of data to this dropdown and place a cascading dropdown for "IssueNo" based on the selection in dropdown for "PartName".

  2. Make the "PartName" autocomplete textbox and implement cascading on IssueNo textbox. I have no idea how to implement this.

When implemented the 1st option, The page is getting too slow since the dropdown need to load around 15000 data to it.If it the 2nd option please help me how to implement it? Also if you feel better third option, please let me know on its implementation.

musefan
  • 47,875
  • 21
  • 135
  • 185
Suja Shyam
  • 971
  • 2
  • 27
  • 57
  • Clearify your question by adding paragraphs, code samples, less text, more info, etc. – Bas Slagter Oct 25 '11 at 07:51
  • 1
    Maybe yuo will find the following answer helpful: http://stackoverflow.com/questions/4458970/cascading-drop-downs-in-mvc-3-razor-view – Darin Dimitrov Oct 25 '11 at 08:06
  • for huge data using pagination is helpful, so instead of a dropdown you could use something like this: http://demo.aspnetawesome.com/LookupDemo – Omu Dec 17 '12 at 04:06

1 Answers1

0

I would definitely go the second way - ajax autocomplete textbox. Dropdown with 15k items is just insane :) There are many ready-made solutions for this:

http://choosedaily.com/1308/15-jquery-autocomplete-plugins-tutorials/

But maybe you should use something like jQuery TokenInput, since you have "exact" items to choose from, with no "free text" option :

http://loopj.com/jquery-tokeninput/

You can also easily implement cascading with it - just use onAdd callback to make another ajax call and populate IssueNo. Something like this :


        $(document).ready(function() {
            $("#partNameInput").tokenInput("/filterPartName", {
                onAdd: function (item) {
                    // populate IssueNo here, possibly with .load(), or .ajax()
                }
            });
        });
        
rouen
  • 5,003
  • 2
  • 25
  • 48