title: How to assign value to JavaScript variable under MVC3 Razor with ViewBag
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11978006/how-to-assign-javascript-value-under-mvc3">How to assign JavaScript value under MVC3</a>  </p>
  </blockquote>
  
  
  
  <p>I try to do the following</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  var techIDs = "";
  
  @if (ViewBag.URLParameters != null)
  {
     techIDs = '@ViewBag.URLParameters';
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>But it seems it's a wrong approach.</p>
  
  <p>Any clue how it could be done?</p>
  
  <p>Thank you!</p>