title: MVC - use C# to fill ViewBag with Json Action Result
body: <p>I have an MVC website with C# code behind. I am using an ActionResult, that returns Json.</p>
  
  <p>I am trying to put something in the ViewBag but it doesn't appear to work.</p>
  
  <p>The code looks like this -</p>
  
  <pre><code>    public ActionResult GetStuff(string id)
      {
          ViewBag.Id = id;
  
          stuff = new StuffFromDatabase(id);
  
          return this.Json(stuff , JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>The "id" does not appear go in the ViewBag.Id. </p>
  
  <p>Can I put the id in the ViewBag this way? If not any suggestions on how I should do it?
  Thanks!</p>