I have an asp.net MVC website. One of the pages allows the user to dynamically add drop down lists to the page, i.e. the user enters 5, this posts back to the server, where in the view I create 5 drop down lists.
What I then want to be able todo is on every post back send all the values of the drop down lists back to the controller, maintaing their position in the array. What I'm finding is that only the changed values are being posted back and I am unable to determine which value changed
?? What, you may ask. Here's an example:
The page allows the user to enter a specification of their house. First they select from a drop down list, drpRooms, the number of rooms in their house (lets say the users enters 5).
This posts back to server and the view is rendered back with 5 additional drop down lists, drpRoom0, drpRoom1, drpRoom2 ... drpRoom4, each drop down lists allow them to select the number of items of furiture in that room, a number between 1 and 10.
The user selects the following values for each drop down
drpRoom0: 2
drpRoom1: 4
drpRoom2: 1
drpRoom3: 8
drpRoom4: 9When the user clicks "Continue" and posts the form back, I get the values in the controller as an array, i.e.. an Array of type int : int[] with values {2, 4, 1, 8, 9}. Upto here I'm okay, I can get the drop down lists posted back as an array of int (I do this by using the same name for each drop down list, but unique ID's)
This will do some processing and so forth. The view gets rendered back to the user and they can change a value, say they change the value of drpRoom3 to value 2, when the user clicks continue, all I get back at the server is an array with 1 value at index 0. Thus I'm unable to determine which drop down list was changed.
I know I can do this with Json, however I'm looking for Javascript independant way in which todo this