Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi..
I'm trying to bind around 2 lakhs of data(ItemId,ItemCode) in a strongly typed drop down list. Using stored procedure to fetch data from DB table. In application, Using entity frame to invoke stored procedure.

public IEnumerable<OPS_GetATCCItems_Result> GetItemMaster_ATCC
       {
           get
           {
               EntityDataModel.StoredProcedures.MastersSPsEntities db = new MastersSPsEntities();
               ItemViewModel _ivm = new ItemViewModel();
               _ivm.getAtccItemMasterDtls_resultList = db.OPS_GetATCCItems().ToList();
               return _ivm.getAtccItemMasterDtls_resultList;
           }
       }


Above function fetch data from DB.

@Html.DropDownListFor(m => Model.getItemRecmdDtls_result.ItemMasterId, new SelectList(Model.ddlContr.GetItemMaster_ATCC, "ItemMasterId", "LgcCode"), "Select",
                                                                      new { @id = "ddlItemCode", @style = "width:280px !important;", @class = "select2", @required = "Required", @title = "Item Code is required." })


Above statement to bind data to dropdownlist.

Any help appreciated.

Thank you.

What I have tried:

Stored procedure taking around 25secs for execution. Drop down list binding comsuming more time.
Posted
Updated 5-Mar-19 4:59am

1 solution

Loading two hundred thousand items into a list is not a viable option. Aside from the length of time it will take to execute the query and load the items, you'll be putting huge pressure on the server's memory, and the client's bandwidth, memory, and battery life.

And it wouldn't achieve anything. If the user could look at one item every second, it would take them over 55½ hours to scroll through the list to find the one item they want.

Based on the CSS class, you're already using Select2[^] to let them search the list. Use the "remote data" option[^] to only load the items which match what the user is searching for. If necessary, use the pagination option[^] to limit the number of items returned in a single response.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900