Changing values of (multiple) dropdown lists from one dropdown list in MVC
Posted
by Mario
on Stack Overflow
See other posts from Stack Overflow
or by Mario
Published on 2010-03-23T17:53:29Z
Indexed on
2010/03/23
18:23 UTC
Read the original article
Hit count: 627
asp.net-mvc
|jQuery
I have an MVC page, with some controls inside a form. The part I need help with: I have a bunch of dropdowns in a list. All dynamically named (drop{0}, where {0} is the id (really, its just a counter: 1,2,3,etc)). At the top of the list, I want to have another dropdown that will update ALL the dropdowns when it is changed. I've done similar things with checkboxes (check one and all are checked, etc) so I assume this can be done, hopefully just as simple. I'd prefer it to be on the client side, so once the form is submitted, the new values will be added/updated to the database.
Edit: The values of ALL the dropdowns are static. They are all a list of 1-50, representing the number of cards I need to produce for a given record.
This is how I did the checkbox:
$("#chkSelectAll").click(function() {
$(".checkbox").attr('checked', this.checked);
});
Any thoughts on where to begin?
Thanks!
© Stack Overflow or respective owner