asp.net mvc 3 - how to use cascading dropdownlist in mvc -


am using asp.net mvc3, have 2 tables in want data dropdown based on dropdown has perform.for example if select country has show states belonging country,am using following code in controller.

viewbag.country= new selectlist(db.country, "id", "name", "--select--");  viewbag.state= new selectlist("", "stateid", "name");     @html.dropdownlistfor(model => model.country, (ienumerable<selectlistitem>)viewbag.country, "-select-")     @html.dropdownlistfor(model => model.state, (ienumerable<selectlistitem>)viewbag.state, "-select-") 

but using able countries.

there jquery plugin can this...

you don't want refresh whole page everytime changes country drop down - ajax call update state drop down far more user-friendly.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -