My team is working on a web application using MVC4 with .NET 4.5. One task is to create a drop-down list of the parent that will update the drop-down list of children when a value is selected in the parent - for example, a drop-down list of states will filter the drop-down list of cities when a state is selected.
In our other projects, we use Ajax calls for a web service or database to populate the values of the child when the parent value is selected. In my example above, the state of Minnesota is selected, and an Ajax call is made to the database to capture all the cities in MN. I read the other posts here and the guides that follow this concept.
The new developer on our team believes that the method above is inefficient, and it’s best to capture all the cities when the page loads, save the cities as a Jason object in a JavaScript variable, and then use jquery to cycle through the JavaScript variable and build a list of children.
Can someone give me feedback on which method they used? I don’t think that pulling thousands of records into the browser, and storing on the client is very effective when we can only show 10 records. This developer also believes that looping through a JSON object with 10,000 lines in JavaScript is faster than calling a database to capture 10 lines.
source
share