title: sending integer value from controller to view in asp.net mvc
body: <p>i am trying to send integer value from controller to view and display in view multiplied by 0.2</p>
  
  <p>here the code in controller </p>
  
  <pre><code>public ActionResult Details()
      {
  
          ViewBag["salary"] = 1400;
          return View();
      }
  </code></pre>
  
  <p>and the code in view </p>
  
  <pre><code>@{
  Layout = null;
  
  
     int Salary=int.Parse(@ViewBag["salary"]);
  }
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width" /&gt;
      &lt;title&gt;Details&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
          &lt;p&gt; Salary: &lt;/p&gt;
          @(Salary / 0.2)
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>but it throw an exception</p>
  
  <blockquote>
    <p>An exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in
    System.Core.dll but was not handled in user code</p>
    
    <p>Additional information: Cannot apply indexing with [] to an expression
    of type 'System.Dynamic.DynamicObject'</p>
  </blockquote>