title: Pass 'value' when 'key' is selected - MVC/Dictionary object
body: <p>I am populating a dictionary object with key value pairs like this..</p>
  
  <pre><code>      Dictionary&lt;string, string&gt; twoValues = new Dictionary&lt;string, string&gt;();
  
          foreach (var item in query)
          {
              twoValues.Add(item.Name, item.Id);
          }
  
          return twoValues;
  </code></pre>
  
  <p>I am returning these value pairs to the controller and populating a MVC model (selectlists)  </p>
  
  <pre><code> model.Names = new SelectList(twoValues.Keys);
   model.Ids   = new SelectList(twoValues.Values);
   return model;
  </code></pre>
  
  <p>In the view I have an action link and a drop down. Drop down is populated with key values of the dictionary (in this case, key is text names, and value is ids)</p>
  
  <pre><code>//Action link 
  
  &lt;%=Html.ActionLink("link", "Method", "Controller", new { Id = ??  })%&gt;
  
  //Drop down   
  
  &lt;%=Html.DropDownList("names", Model.Names, "")%&gt;      
  </code></pre>
  
  <p>How do I pass the Id associated with the selected Name in drop down to the controller via action link?</p>
  
  <p>I tried having another drop down list next to names with the ids .. but somehow I need to maintain the link between the two drop downs.. since I am separating the dictionary key value pairs in the view for display...</p>
  
  <p>I can have something like...</p>
  
  <pre><code>//Action link 
  
  &lt;%=Html.ActionLink("link", "Method", "Controller", new { Id = ??  })%&gt;
  
  //Drop down   
  
  &lt;%=Html.DropDownList("names", Model.Names, "")%&gt;     
  &lt;%=Html.DropDownList("ids", Model.Ids, "")%&gt;   
  </code></pre>
  
  <p>How do I pass the id via the action link for the selected 'Name' drop down list.</p>