title: How to store Dictionary<string, string> in hidden field and retrieve the same in controller through FormCollection Id
body: <p>The Scenario is where :-</p>
  
  <p>Controller part :</p>
  
  <pre><code>    public ActionResult GoHt()
      {
          Dictionary&lt;string, string&gt; col = new Dictionary&lt;string, string&gt;();
          col.Add("A", "C");
          col.Add("B", "C");
          ViewBag.Cols = col;
          return View();
      }
  </code></pre>
  
  <p>View Part :</p>
  
  <pre><code>    &lt;input type="hidden" id="HD" name ="HD" value="@ViewBag.Cols" /&gt;
  </code></pre>
  
  <p>In this case hidden value is not showing Dictionary element which id defined instead it is show as</p>
  
  <pre><code>    &lt;input type="hidden" id="HD" name="HD"  value="System.Collections.Generic.Dictionary`2[System.String,System.String]"&gt;
  </code></pre>
  
  <p>Here the Question is , how do i assign Dictionary element to ViewBag and store in Hidden field.</p>
  
  <p>and how do the same Dictionary  is made available at Form Submission.</p>
  
  <p>Controller :</p>
  
  <pre><code>    [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult GoHt(FormCollection formCollection)
      {
  
          var Mode = (Dictionary&lt;string, string&gt;)formCollection["HD"].ToString();
      }
  </code></pre>