c# - Bind Dropdownlist with viewbag get slow -


i'm trying bind list dropdownlist using 'htmlhelper' , slow. have approximately 200k records in dropdown list using select2.js searchable dropdown. how can make faster?

  @html.dropdownlistfor(model => model.stundetnumber, (list<selectlistitem>)viewbag.studentnumber, new { @class = "form-control stundetnumber select2", @multiple = "" }) 

you creating dropdown 200k items in view. may applying select2.js after that, server still has render , serve 200k items. it's going slow, , browser have trouble rendering intial dropdown.

you should investigate loading data on demand, such select2.js provides ajax support: https://select2.github.io/examples.html#data-ajax


Comments

Popular posts from this blog

c++ - CPP, 'X' button listener -

shared memory - gstreamer shmsrc and shmsink with h264 data -

r - Add string of (variable number of) arguments to a function within a function -