I've read the links listed when I was creating this question. I think what I'm trying to do differs slightly. I am using ASP.NET MVC 2. 

Apologies for the incoming wall of text. The most brief way I can think to ask this question is immediately below. After that I go into more of the why and how of the question.

[VERY QUICK POINT OF THE QUESTION]
How do I return a dictionary as a JSON result from an action and what jquery/javascript could be used in the onLoad event of the drop down lists to search that JSON for a named element and if it is found, return the corresponding value and pre-select that value in the drop down list?

[BACKGROUND]
I am working on creating a project for work where the user select an option from 2 initial drop downs. The first drop contains a list of pdf file names. The second drop downs contains a list of database queries associated with an alias name (they do not see sql...they see the name of the corresponding stored procedure or view). After the user has made these 2 selections the page reloads with many more drop downs below in 2 columns.

On the left column is a list of drop downs that all contain the same content: a list of the names of the text fields contained within the selected pdf (I am using CeTe software's Dynamic PDF to handle pdf interaction). On the right column will be a list of drop downs containing the field names of the selected query. Both columns will have an equal number of drop downs; the total number will be the number of fields on the pdf.

[PROBLEM]
I can load the page fine and populate the drop downs with their respective data. The problem comes after the submit button is clicked and the data is posted. Since the drop downs are created dynamically, I'm using a naming convention to link which selections belong to the pdf fields and which belong to the db fields. On the action side, I iterate over the FormCollection and create a dictionary where the key is the name of the element posted and the value is the value of the element that was submitted. I only add entries to the dictionary for elements that have a non-null, non-empty value.

So far, I have all of that working. My issue, as you've probably guessed, is maintaining the selections when the page returns from the Action back to the view. I've got some really mutilated code that is close, but probably a world away from a good solution.

I will post the code I have that makes sense below. Another idea I have, that I've no clue how to go about doing is to put a function in the onLoad event of the drop down lists and goes to a json action and sends posts the name of the drop down calling the action/script (whatever this becomes). If the name submitted exists in the dictionary where I'm storing the previously submitted names & values of the drop down lists, the corresponding value that should be pre-selected is returned; otherwise nothing is returned and none of the drop down's values are pre-selected.

I don't know much about JSON, but if I could return the previously posted name/value dictionary as a JSON result to the page, I could use jquery to parse the json and handle the preselection where needed on the drop down.

See my current code below. It could be emulated by just creating stubs data for the SelectItemLists if you so cared. The current issue is that whatever the last name/value element is in the pre-selected dictionary is what is pre-selected for the rest of the list of drop downs. 

Ex:

Selected values:

```
A                   FirstName
B                   LastName
C                   SSN
<no selection>      <no selection>
<no selection>      <no selection>
<no selection>      <no selection>
<no selection>      <no selection>

```

If the above is submitted, the result is the following:

```
A                   FirstName
B                   LastName
C                   SSN
C                   SSN
C                   SSN
C                   SSN
C                   SSN

```

Current code:

```
           <% using (Html.BeginForm())  {  %>                 

   <%  
       List<SelectListItem> mainPdfFieldNames = (List<SelectListItem>)ViewData["PdfFieldNames"];
       List<SelectListItem> mainDbFieldNames = (List<SelectListItem>)ViewData["DbFieldNames"];
       Dictionary<String, String> fieldValue = (Dictionary<string, string>)ViewData["selectedFieldValues"] ?? new Dictionary<string, string>();

   %>

   <% for (int i = 0; i < mainPdfFieldNames.Count; i++)
{

        String pdfPreselectValue = string.Empty; 
        String dbPreselectValue = string.Empty;
        fieldValue.TryGetValue("PdfFieldNames" + i.ToString(), out pdfPreselectValue);
        fieldValue.TryGetValue("DbFieldNames" + i.ToString(), out dbPreselectValue);
        IDictionary<string, object> pdfHtmlAttrib = new Dictionary<string, object>();
        IDictionary<string, object> dbHtmlAttrib = new Dictionary<string, object>();
        List<SelectListItem> pdfFieldNames = mainPdfFieldNames;
        List<SelectListItem> dbFieldNames = mainDbFieldNames;
%>
       <%=  Html.Encode(" PDF Selected value: " + pdfPreselectValue )  %>
       <%=  Html.Encode(" DB Selected value: " + dbPreselectValue) %>
<%        
        if (!String.IsNullOrEmpty(pdfPreselectValue))
        {
            pdfFieldNames.Find(p => p.Value.Equals(pdfPreselectValue)).Selected = true;
            pdfHtmlAttrib.Add("selected", null);
        }

        if (!String.IsNullOrEmpty(dbPreselectValue))
        {
            dbFieldNames.Find(p => p.Value.Equals(dbPreselectValue)).Selected = true;
            dbHtmlAttrib.Add("selected", null);
        }
          %>

       Select PDF Field: <%=Html.DropDownList("PdfFieldNames" + i.ToString(), pdfFieldNames, "Select PDF Field", pdfHtmlAttrib)%>
       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       Select Database Field: <%=Html.DropDownList("DbFieldNames" + i.ToString(), dbFieldNames, "Select Database Field", dbHtmlAttrib)%>
       <br />
   <%
      }%>

   <input type="submit" value="Submit" />

   <% } %>  

```

**MAJOR EDIT 1** OMITTED TO MAKE ROOM FOR SOLUTION

I've decided to go a different route with this. I think this might be more simplified in the end. After the view posts to the action, I create a string variable from the Dictionary I was previously using. This string is put in ViewData and on the page is a hidden field. I have a javascript function that grabs this field and parses it. The nameValue field has the format of "fieldname,fieldvalue;fieldname,fieldvalue;fieldname,fieldvalue".

I am posting some test code below. It's actually a full html page that I'm using to develop this process bit by bit. My only remaining issue is triggering code to load after the page has been loaded. This code will select all drop downs on the page, iterate over them, and pass the name of the drop down to the function I've created that handles pre-selecting a value on the drop down based on it's name and whether that name exists in the nameValue hidden field on the page.