title: How to implement a view in MVC to render a Dictionary within a Model and to map the dictionary back into the Model
body: <p>Let's say you have this Model:</p>
  
  <pre><code>//model 
  public class Stuff
  {
    public string Name { get; set; }
    public Dictionary&lt;String, String&gt; Description { get; set; }
  }
  </code></pre>
  
  <p>I want to be able to be able to create an action and it's corresponding view so users can add in the form the Name of the Stuff object, and can add multiple Description entries.  </p>
  
  <p>In this particular case, I want the key to be a language code like 'en', 'de', 'fr', 'es', etc. and the description the corresponding description for the given language.</p>
  
  <p>For example, in the View you might see something like this:</p>
  
  <pre><code>@model Stuff
  
  @using(Html.BeginForm())
  {
     &lt;div&gt;
         @Html.LabelFor(x=&gt;x.Name)
         @Html.TextBoxFor(x=&gt;x.Name)
     &lt;/div&gt;
     &lt;div&gt;
          &lt;!-- What goes in here to map to the Dictionary in the Stuff Model? --&gt;
          &lt;input name="LanguageCode" value="en" /&gt;  &lt;input name="DescriptionValue" /&gt;
          &lt;input name="LanguageCode" value="de" /&gt;  &lt;input name="DescriptionValue" /&gt;
          &lt;input name="LanguageCode" value="fr" /&gt;  &lt;input name="DescriptionValue" /&gt;
     &lt;/div&gt;
     &lt;div&gt;
          &lt;input type="submit" value="save" /&gt;
     &lt;/div&gt;
  }
  
  
  // controller
  
  [HttpGet]
  public ActionResult Index ()
  {
    return View(new Stuff());
  }
  
  [HttpPost]
  public ActionResult Index (Stuff myStuff)
  {
    foreach(KeyValuePair kvp in myStuff.Description)
    {
         Trace.WriteLine(String.Format("Language: {0} - Description: {1}", kvp.Key, kvp.Value)); 
    }
    DBHelper.Save(myStuff);
    return View();
  }
  </code></pre>
  
  <p>Any alternative solutions are accepted.</p>
  
  <p>Thanks.</p>