David
David

Reputation:

Multiple/addable drop down lists in asp.net mvc

Is it possible to have multiple drop down lists in asp.net mvc?

What I'm trying to do is have a drop down list, say with many colours, Red, Green, Blue, Black etc. Then next to it a text box which the user can enter a number.

However there should be then a small + little sign next to it so that another drop down list appears underneath it allowing the user to select another colour. The number of times they can add drop down boxes should ideally be unlimited. Is this possible? I know I can put hidden drop down lists underneath them then enable/show them when the user clicks the + button, but this will only mean a limited number of drop down lists!

Thanks

Upvotes: 0

Views: 788

Answers (3)

Gregoire
Gregoire

Reputation: 24872

you can add an ajax action link that will update a div with a drop down list and the same div. So you can add as many dropdown list you want.

Upvotes: 0

JMP
JMP

Reputation: 7844

Sure, you can add as many pull-down menus to your page as you like (and it sounds like you are comfortable with the scripting to do so). Just make sure to add a unique name to each of those menus so you can access the values in your controller.

Upvotes: 1

epitka
epitka

Reputation: 17657

This has nothing to do with ASP.net mvc. It is a pure JavaScript. Use jQuery to add ddl dynamically.

Upvotes: 1

Related Questions