c# - Dependent Dropdown-Lists using DropDownListFor -


i got 2 drop down in mvc razor-view:

@html.dropdownlistfor(x => x.selectedprefix, model.getassignableprefixes() , new { @id = "prefixdropdown" })  @html.dropdownlistfor(x => x.selectedsuffix, model.getassignablesuffixes(model.selectedprefix) , new { @id = "suffixdropdown" }) 

selection of first dropdown should change content of second dropdown depending of value selected in first dropdown. (therefor method getassignablesuffixes(model.selectedprefix) called)

as there quite complex calculations, not want put logic javascript-method

i've found "quite" simular questions here @ so, not dropdownlistfor. there approach fior that?

dropdownlistfor evaluated on server when page first rendered. you're going have @ least partially client-side. push calculations onto server doing ajax call when first dropdown changes , populate second dropdown results returned ajax call.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -