title: asp.net mvc inject js code into Razor
body: <p>How I can do it?</p>
  
  <pre><code>$for (var i = 0; i &lt; model.CategoryList.length; i++) {
     var text = model.CategoryList;
     categories += '&lt;span class="label label-info"&gt;' + @((AgesCategory)int.Parse( ..... )).GetDescription() + '&lt;/span&gt;';
   }
  </code></pre>
  
  <p>I need replace <strong>int.Parse( ..... ))</strong> to <strong>int.Parse(model.CategoryList[i])</strong> from JS code. I can't add <strong>text</strong> variable into <strong>int.Parse( ... )</strong> intellisense detected this code like c# code, not JS.</p>
  
  <p><strong>update:</strong> </p>
  
  <p>I'll try reformulate my question: How I can set value C# variable from JS variable?</p>
  
  <pre><code>&lt;script&gt;
      var temp1 = 1;   // js var
      @{ string temp2 = 0 ;}  // c# var
      @{ temp2 = temp1 } // how do it?
      var temp2 = @(((MyEnumType)int.Parse(temp2).GetEnumDescription()));  //js var
  &lt;/script&gt;
  </code></pre>
  
  <p>what need use? '@:' or something else? In all case I get syntax error</p>