I have a datatable that I'm trying to use for storing a matchup between two columns of dynamic controls (a span holding data on the left is matched up to choices from dropdownlists on the right).
I want the datatable to save and store the data between postbacks but it seems to be resetting/not-saving.
The code I'm providing is a full working example (aspx and vb). On the page try picking something from one dropdownlist and see that it saves; then choose something from another dropdownlist and see that your new choice saves BUT your old choice for the other dropdownlist does not stay saved. Also try picking something in a dropdownlist (notice that it saves to the datatable), then click the "div 2" button and notice that the data resets. (I'm talking about what data that is shown in the gridview and not by the controls themselves... actually this bring up another problem: I'm trying to have the dynamic controls display what is saved in datatable, but they don't seem to be.)
Essentially what I'm trying to accomplish is the following:
If the datatable is empty (a.k.a. the page is loading for the first time) build the dynamic controls and try to automatch values.
If the datatable is filled with data, then build the dynamic controls and select values for the dropdownlist based off of what is saved in the datatable.
When a user chooses something in one of the dropdownlists AND that value hasn't already been picked in another dropdownlist save that value to the datatable
If the user chooses something that already has been picked, then display an error message and don't save the value to the datatable.
I've attached a working code sample for illustration purposes.