title: Using ViewBag in a switch statement
body: <p>Here is the code in my controller:</p>
  
  <pre><code>public ActionResult MyMethod(string widgetId)
      {
          ViewBag.Widget = widgetId;
          ViewData["widget"] = widgetId;
          return View();
      }
  </code></pre>
  
  <p>And here is what I tried in the switch statement:</p>
  
  <pre><code>var sort = &lt;%=(string)ViewBag.Widget.ToString() %&gt;;
      //switch (&lt;%=(string)ViewData["widget"] %&gt;) {   
      switch (sort) {            
          case 'a1':
  
              break;
          case 'a2':
  
              break;
          case 'a3':
  
      }
  </code></pre>
  
  <p>In my case, the widgetId is 'a3'</p>
  
  <p>And it throws error that a3 is undefined. How to fix this? I </p>